Support » Fixing WordPress » How to edit Show_Count numbers!

  • Resolved ForumWT

    (@forumwt)


    how to edit show_count i need to change from

    <li class="cat-item cat-item-6"><a href="http://site.com/ccc/">Category</a> (40)</li>

    to

    <li class="cat-item cat-item-6"><a href="http://site.com/ccc/">Category <span>40</span></a></li>

    And here is my code in template sidebar

    <?php
    $catlist=wp_list_categories("echo=0&orderby=name&show_count=1&hierarchical=0&title_li=0&hide_empty=0");
    	$catlist=preg_replace('/title=\"(.*?)\"/','',$catlist);
    echo $catlist;
    ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • hi @forumwt

    you can try this

    $catlist=wp_list_categories("echo=0&orderby=name&show_count=1&hierarchical=0&title_li=0&hide_empty=0");
    $catlist=preg_replace('/\(([^)]+)\)/','<span>$1</span>',$catlist);
    echo $catlist;

    Hope this helps

    Thread Starter ForumWT

    (@forumwt)

    No its not work, with this i have

    <li class="cat-item cat-item-6">
    <a href="http://site.com/ccc/">Category </a>
    <span>40</span>
    </li>

    but i need

    <li class="cat-item cat-item-6">
    <a href="http://site.com/ccc/">Category <span>40</span></a>
    </li>

    ok so you want it inside the link, try this instead:

    $catlist=wp_list_categories("echo=0&orderby=name&show_count=1&hierarchical=0&title_li=0&hide_empty=0");
    $catlist=preg_replace('/\(([^)]+)\)/',' <span>$1</span>',$catlist);
    $catlist=str_replace("</a>","",$catlist);
    $catlist=str_replace("</span>","</a></span>",$catlist);
    echo $catlist;
    Thread Starter ForumWT

    (@forumwt)

    Yes its work, thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to edit Show_Count numbers!’ is closed to new replies.