WordPress.org

Forums

Can't change wp_list_categories in sidebar.php (2 posts)

  1. calpernia
    Member
    Posted 6 years ago #

    Hello, thanks in advance for your help. I have searched the forums, bug reports and other resources before asking this question and was unable to find an answer.

    I have a long list of categories, and wanted to experiment with some restrictions but I found that any changes I made to any code in the following block had zero effect and resulted in the regular list headed "Categories" that displays all categories:

    <!-- sidebar east START -->
    	<div id="eastsidebar" class="sidebar">
    	<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('east_sidebar') ) : ?>
    
    		<!-- categories -->
    		<div class="widget widget_categories">
    			<h3>Categories</h3>
    			<div class="content">
    				<ul>
    					<?php wp_list_categories('exclude=5'); ?>
    				</ul>
    			</div>
    		</div>
    
    	<?php endif; ?>
    	</div>
    	<!-- sidebar east END -->

    No change to anything anywhere in this block of code in sidebar.php has any effect or results in anything but the regular listing. Even changing <h3>Categories</h3> to <h3>Schmattergories</h3> has no effect, and the heading is still "Categories". Deleting <?php wp_list_categories('exclude=5'); ?> has no effect, they still display. Yet deleting that entire block of code, everything in between the comment tags, DOES result in no categories nor the categories heading being displayed.

    Yet any change to the code right below, `<!-- sidebar west START -->
    <div id="westsidebar" class="sidebar">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('west_sidebar') ) : ?>

    <!-- archives -->
    <div class="widget widget_archive">
    <h3>Archives</h3>
    <div class="content">

      <?php wp_get_archives('type=yearly'); ?>

    </div>
    </div>

    <?php endif; ?>
    </div>
    <!-- sidebar west END -->` shows up immediately. Renaming the heading, adding conditions to the function call, everything shows up immediately.

    I am running WP Supercache, but turned it off and manually deleted all cache files to test these changes. Any ideas?

  2. stvwlf
    Member
    Posted 6 years ago #

    Do you have any widgets activated on that first sidebar?

    This line of code

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('east_sidebar') ) : ?>

    means that if there are any widgets active, the code that follows the IF statement up through the closing of the IF statement, is not going to run.

Topic Closed

This topic has been closed to new replies.

About this Topic