• Resolved lisaisbell

    (@lisaisbell)


    I have installed a theme called “the web news” at https://www.whiteoakattic.com

    In a bar running under the name of the blog it lists the blog categories. For some reason they disappeared when I edited the names of them. I thought it had something to do with the length of the name, letter of the alphabet they start with, whatever, but experimentation just resulted in more of them disappearing – only two are left ??

    In the page source I can see the code for them in the header but when I go to the theme editor I cannot see this code in the header template. I know just enough about this to tear it up completely.

    Where else can I go to add the names/links of the post categories I want to appear there in that bar?

    Thanks,
    Lisa I.

Viewing 9 replies - 1 through 9 (of 9 total)
  • esmi

    (@esmi)

    Does your theme’s header.php file contain <?php wp_list_categories();?>?

    Thread Starter lisaisbell

    (@lisaisbell)

    erm, where do I look to find out? (see what I mean, I know just enough to be dangerous ??

    Lisa

    esmi

    (@esmi)

    Admin/Appearance/Editor. Ensure that you are viewing your current theme’s files and then select header.php.

    Thread Starter lisaisbell

    (@lisaisbell)

    It has this, which is very close to what you typed:
    <?php dp_list_categories(); ?>

    esmi

    (@esmi)

    Then this may just have become a bit more complex. You’ll need to locate your theme’s functions.php file and drop a copy of it into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

    Thread Starter lisaisbell

    (@lisaisbell)

    Well, this is pretty much the story of my life ??

    Here is the link to the pastebin page with the a copy of the functions.php file:

    https://wordpress.pastebin.ca/1800751

    Can anybody tell what’s wrong?

    Thanks,
    Lisa

    esmi

    (@esmi)

    Here’s the relevant bit of code:

    # Displays a list of categories
    function dp_list_categories($exclude='') {
    	if (strlen($exclude)>0) $exclude = '&exclude=' . $exclude;
    	$categories = get_categories('hide_empty=1'.$exclude);
    	$first = true; $count = 0;
    	foreach ($categories as $category) {
    		$count++; if ($count>5) break; // limit to 5
    		if ($category->parent<1) {
    			if ($first) { $first = false; $f = ' class="f"'; } else { $f = ''; }
    			?><li<?php echo $f; ?>>
    			<a href="<?php echo get_category_link($category->cat_ID); ?>"><?php echo $category->name ?><?php echo $raquo; ?></a></li>
    			<?php
    		}
    	}
    }

    Currently, the line if ($count>5) break; means that you are limited to displaying only 5 category links in that menu. Almost certainly the oldest 5 categories.

    Thread Starter lisaisbell

    (@lisaisbell)

    Currently just 3 are showing. I only have a total of 5 categories, I went with subcategories beneath those. One difference with this site compared to the others is that it has a Shopp plugin installed for e-commerce. Would that have anything to do with this little oddity?

    The other thing I was wondering is could I simply look at this body of code on the sites that are running it just fine and see if there is something different from one to the other? Copy and past what the other site has back into this one or something like that?

    Thanks,
    Lisa I.

    Thread Starter lisaisbell

    (@lisaisbell)

    I changed templates and now all is well. ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Help Fixing Where Category Names Display’ is closed to new replies.