how do i add different custom right sidebars with different widths and content on different pages in wordpress? -


i have afew pages in wordpress need different custom right sidebars on different css styles. example homepage right sidebar set width 100px , displaying specific content , id have special offers page right sidebar thats different width 230px displaying different content widgets etc...

to understanding should able achieved creating custom sidebars registering them wordpress function , creating custom sidebar template php file different css class sidebar. , calling new custom sidebar template file inside of custom page template file being applied target page in wordpress page loads custom sidebar template instead of normal sidebar template new css class can modified achieve different sidebar styles different pages. created following custom sidebar template , called customrightsidebar.php

<div id="sidebar3"><div class="sidebar3"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('customright-sidebar') ) : ?><div class="customright-sidebar"><h4>recent posts</h4><ul><?php wp_get_archives('type=postbypost&limit=5'); ?> </ul></div><?php endif; ?></div> <br style="clear:both"></div> 

i registered new custom sidebar using function

register_sidebar(array('name'=>'customright-sidebar','before_widget' => '<div class="customright-sidebar">','after_widget' => '</div>','before_title' => '<h4>','after_title' => '</h4>',)); 

and here custom page template calling custom sidebar template

<?php get_header(); ?><div id="breadcrumb"><?php breadcrumbs(); ?></div>  <?php include(templatepath."/customrightsidebar.php");?>  <div id="kontenutama"> <div class="postingan2"><?php if (have_posts()) : while (have_posts()) : the_post(); ?><h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2><?php the_content(); ?><?php endwhile; else: ?> <p><?php _e('sorry, no posts matched criteria.'); ?></p><?php endif; ?><br style="clear:both;"></div></div>   <br style="clear:both"><div style="clear:both"></div><?php get_footer()?> 

i have custom right sidebar appears in wordpress admin panel , can apply widgets in widgets section of admin panel can see appear in custom sidebar dropdown selection menu in wordpress pages specify new custom sidebars overwrite old ones. can see screenshot of sidebar selection boxes in theme visiting url

http://test.smartphonesource.org/sidebars.png

and selecting it overwrite default sidebars on page

i have been able custom sidebar template load custom class on page , ive been able edit css actual custom sidebar widgets isnt appearing or overwriting though ive selected overwrite right sidebar of current page in custom sidebars selection box

im not sure go here or if there different way think somewhere customsidebar isnt overwriting default right sidebar when been selected in custom sidebar selection box on pages im new wordpress , php. ive been able use customright-sidebar on videos page testing , overwrote right sidebar , worked running default right sidebar template

<div id="sidebar2"><div class="sidebar2"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar right') ) : ?><div class="left-sidebar"><h4>recent posts</h4><ul><?php wp_get_archives('type=postbypost&limit=5'); ?> </ul></div><?php endif; ?></div> <br style="clear:both"></div> 

anyhelp appreciated figuring out =) can see homepage of site here im using learn wordpress , there can navigate videos , special offers page im tearing apart better idea of im trying sidebars

http://test.smartphonesource.org

first of all, website looks awesome:) , fix did make sure page grabbing new sidebar code only?


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -