• Hello, guys!

    I want to integrate wordpress pages an categories, as you can see, on image below.

    check out the image

    My website’s pages structure is like that.
    “company history” and “our team” pages are sub-pages of “about us”
    and “category 1” and “category 2” are post categories.

    I want to create drowpdown menu by this structure.

    So, do you have any idea, which way is best to create menu like that?

Viewing 3 replies - 1 through 3 (of 3 total)
  • There is no easy way to mix pages and categories into a single menu. Your best option is to create a page-only menu and have a look at the Page Links To plugin.

    Thread Starter Landish

    (@landish)

    @esmi
    thanks for respond.

    I am trying to do the same thing.

    I have no problems getting the pages and categories to work together but I am having trouble getting the correct subcategories returned for the parent category that is being viewed. (I am not using drop downs for level 2, I am using a contextual level 2) anyway, here is what I have done to achieve the page and category integration.
    `
    <div id=”nav_panel” class=”clearfix”>

    <div id=”nav1″>

      <?php wp_list_pages(‘depth=1&title_li=’); ?> <!–this bit gets the parent pages–>

      <?php wp_list_categories(‘hide_empty=0&depth=1&exclude=1&title_li=’); ?> <!–this bit gets the parent categories–>

    </div> <!– end: nav1 –>

    <div id=”nav2″ class=”clearfix”>
    <?php

    if (is_category()) {

    /* Im having trouble with this section (getting the right children of parent Category */

    $this_category = get_category($cat);

    foreach((get_the_category()) as $childcat) {
    if (cat_is_ancestor_of($this_category->cat_ID, $childcat)) {

    echo ‘<ul id=”subpage_menu”>’;

    wp_list_categories(‘exlude=1&show_count=0&title_li=&use_desc_for_title=1&child_of=’.$this_category->cat_ID);
    echo “”;

    } else{
    echo ‘<ul id=”subpage_menu”>’;

    wp_list_categories(‘hide_empty=0&depth=1&exclude=1&title_li=’);

    echo “”;
    }

    }
    }
    /* End of troubled section */

    // Getting the subpages ***** THIS WORKS FINE *****
    elseif (is_page()) {

    echo ‘<ul id=”subpage_menu”>’;
    if($post->post_parent)
    wp_list_pages(“title_li=&depth=1&child_of=”.$post->post_parent); else
    wp_list_pages(“title_li=&depth=1&child_of=”.$post->ID);

    echo “”;
    }
    ?>

    </div><!– end: nav2 –>
    </div> <!– end: nav_panel –>

    I hope that this helps.

    PS if you know how to fix my issue with getting the child categories please leave a comment at my open thread: http://wordpress.org/support/topic/403357?replies=1#post-1528815

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘HOW TO integrate wordpress pages and categories list?’ is closed to new replies.