Dynamic Sidebar Customization
-
I’m using the wordpress theme black tec. The dynamic sidebar on the right is not working properly.
I can still add and take away widgets, but the two headings, blogroll, and categories, will not go away no matter how I have my widgets set up. How do I make my sidebar blank so I can customize it with widgets to fit my needs?
sidebar.php
<!-- Sidebar --> <div class="sidebar"> <h3>Pages</h3> <ul> <?php wp_list_pages('title_li='); ?> </ul> <h3>Archives</h3> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?> <?php endif; ?> </div> <!-- Sidebar -->functions.php
<?php if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Sidebar Left', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>', )); register_sidebar(array( 'name' => 'Sidebar Right', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>', )); ?>
-
The reason pages and archives won’t go away is they are outside the part of the code that the widgets override if any are active. You have two choices. Either delete those sections altogether
<div class="sidebar"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?> <?php endif; ?> </div>or put them inside the if statement
<!-- Sidebar --> <div class="sidebar"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?> <h3>Pages</h3> <ul> <?php wp_list_pages('title_li='); ?> </ul> <h3>Archives</h3> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <?php endif; ?> </div> <!-- Sidebar -->It’s not the pages and the archives I want gone, it’s the categories and the blogroll in the right sidebar. Will this code do that?
Thanks for your input~
…I think the biggest problem is that I can’t find any values for the right sidebar in any of the code. (Sorry if my terminology is wrong.)
See if you have a second sidebar template file in your theme folder.
No, there isn’t, I even re-downloaded the theme,here to check… If it helps, this is the page.php
<?php get_header(); ?> <?php get_sidebar(); ?> <!-- Content --> <div id="content"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <!-- Post --> <div class="post" id="post-<?php the_ID(); ?>"> <div class="post-title"> <div class="post-date"> <span><?php the_time('d') ?></span> <?php the_time('M') ?> </div> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> af: <?php the_author() ?> | <?php the_category(', ') ?> </div> <div class="post-entry"> <?php the_content('Read <span>more...</span>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> </div> </div> <!-- /Post --> <?php endwhile; ?> <?php else : ?> <!-- Post --> <div class="post"> <div class="post-title"> <h2>Not Found</h2> </div> <div class="post-entry"> <p>Sorry, but you are looking for something that isn't here.</p> </div> </div> <!-- /Post --> <?php endif; ?> <div class="clear"></div> </div> <!-- /Content --> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar2') ) : ?> <?php endif; ?> <?php get_footer(); ?>Thank you.
These lines of code at the end
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar2') ) : ?> <?php endif; ?>load a second sidebar. Its contents would be from widgets.
If you can’t find the widgets for the 2nd sidebar, temporarily remove those lines of code and see if the categories and blogroll disappear.
No, they still show up. I have no idea what it could be…
I even took
register_sidebar(array( 'name' => 'Sidebar Right', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>', ));out of the functions.php, but the sidebar still shows up. I have no idea what could be telling it to display.
well they are not coming from your sidebar code, so look elsewhere
I’ve looked through every file, still nothing. Thank you for trying though, I will keep at it.
The topic ‘Dynamic Sidebar Customization’ is closed to new replies.