• I’ve been trying to comply with the new tags for days with not much success: I’m using wp_list_categories to display my categories like this:

    <?php wp_list_categories('show_count=1&title_li=<h1>Categories</h1>&hide_empty=1' ); ?>

    and all I get is this:

    <li class="categories"><h1>Categories</h1><ul>	<li><a href="https://huitzilop.kicks-ass.net/blog/index.php/category/general/" title="Ver todas las entradas de General">General</a> (14)
    </li>
    <li><a href="https://huitzilop.kicks-ass.net/blog/index.php/category/meme/" title="Ver todas las entradas de meme">meme</a> (1)
    </li>
    </ul></li>

    That is a messy way to display a list of links, not to mention I don’t want the title to be part of the ul. Is there any way I can make this tag show:

    <h1>Categorias</h1>
    <li><a href="https://huitzilop.kicks-ass.net/blog/index.php/category/general/" title="Ver todas las entradas de General">General</a> (14)</li>
    <li><a href="https://huitzilop.kicks-ass.net/blog/index.php/category/meme/" title="Ver todas las entradas de meme">meme</a> (1)</li>
    </ul>

    because right now the generated markup seems to be really messy and buggy.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can eliminate the title by doing this: …&title_li=&…

    Basically just set the title_li parameter to nothing. It will not render then. Here is an example of what I’m doing:

    wp_list_categories(‘orderby=name&show_count=1&use_desc_for_title
    =0&title_li=&child_of=’ . $this_category->category_parent);

    Good luck! ??

    Ben

    Thread Starter HuitZiloP

    (@huitzilop)

    Hi Ben, thanks for your reply. When I use your first suggestion, I get the links listed exactly the way I want, but without the typical indent of a li element. Is there any way (only one I think of is CSS, but don’t know how to do it, kinda newb here) to give them that indent so they line up with my other li’s?

    Your other suggestion gives me weird mysql errors:

    Warning: join(): Bad arguments. in C:\server\www\blog\wp-includes\category.php on line 277
    
    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND post_type = 'post' AND post_status = 'publish'' at line 1]
    SELECT post_id, category_id FROM wp_post2cat LEFT JOIN wp_posts ON post_id = ID WHERE category_id IN () AND post_type = 'post' AND post_status = 'publish'
    
    Warning: Invalid argument supplied for foreach() in C:\server\www\blog\wp-includes\category.php on line 287
    # No categories

    Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Categories driving me nuts’ is closed to new replies.