WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_cats ? (2 posts)

  1. TheDiamondBuyingGuide
    Member
    Posted 5 years ago #

    WordPress 2.6.2

    I am using a theme that relies on wp_list_cats. I believe that it was replaced with wp_list_categories with the new update, but when I change it, the menu is not perfectly aligned. Is it a must to change it? If the old wp_list_cats works fine, is it ok to keep it or are there any specific issues with it?

    Finally, I do have one problem that doesn't seem to get resolved when I use wp_list_cats or wp_list_categories for that matter.

    At the end of my menu code, I have a stupid
    <ul> out of nowhere... which prevents my website from validating.

    This is how my list starts:

    <div class="box">
     <h3>Categories</h3>
     <ul>
     <li class="cat-item cat-item-20"><a href="http://www.thediamondbuyingguide.ca/category/diamond-buying-guide-in-4-easy-steps/" title="View all posts filed under Diamond Buying Guide in 4 easy steps">Diamond Buying Guide in 4 easy steps</a>
    </li>

    and then after all the menu items are inserted, this is how it ends:

    <li class="cat-item cat-item-11"><a href="http://www.thediamondbuyingguide.ca/category/precious-metals/yellow-gold/" title="View all posts filed under Yellow Gold">Yellow Gold</a>
    </li>
    </ul>
    </li>
     <ul>
     </div>

    the last ul and /div don't seem to belong there... Any idea if I can find the code for wp_list_cats somewhere and edit it manually?

  2. TheDiamondBuyingGuide
    Member
    Posted 5 years ago #

    This document was successfully checked as XHTML 1.0 Transitional!

    Nice! That was the most stupid mistake ever... I found the answer myself. Believe it or not... I had put this in sidebar.php

    <div class="box">
            	<h3>Categories</h3>
            	<ul>
            	    <?php wp_list_cats('sort_column=name&hierarchical=1'); ?>
            	<ul>
            </div>

    instead of:

    <div class="box">
            	<h3>Categories</h3>
            	<ul>
            	    <?php wp_list_cats('sort_column=name&hierarchical=1'); ?>
            	</ul>
            </div>

    I can't believe I spent like 3 hours looking on the net and rereading the code over and over to figure that out... ! Duh!

Topic Closed

This topic has been closed to new replies.

About this Topic