Forums

Help with code for putting Pages and Categories in top navigation buttons (2 posts)

  1. delocurr
    Member
    Posted 2 years ago #

    I searched the forums and found this solution several times, but I do not know Php, and so do not know exactly where to put the code or how to write it correctly.

    Here is the code that exists in my header.php

    <?php
                       if(get_option('fusion_topnav')=='categories') { echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a$2><span><span>$3</span></span></a>', wp_list_categories('show_count=0&echo=0&title_li='));  }
                      { echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a$2><span><span>$3</span></span></a>', wp_list_pages('echo=0&orderby=name&title_li=&')); }
                      ?>

    Here is what was suggested:

    Add <?php wp_list_categories(); ?>, either to your theme sidebar.php, or into header.php
    Add it right after <?php wp_list_pages(); ?> in header.php .The menu is showing both pages and categories

    How do I write that, and where do I put it?

    Thank you in advance.

  2. delocurr
    Member
    Posted 2 years ago #

    Interesting. I acidentally came upon a solution. When I pulled my page widget into my sidebar, the page I was trying to list among my category navigation just showed up. Just like that...But I would still like a solution for my previous post.

    Also--

    Now is there a way to work out the order of the labels in the navigation bar?

Topic Closed

This topic has been closed to new replies.

About this Topic