Solved

Wordpress wp_list_pages  show categories and posts as children

Posted on 2009-07-13
2
679 Views
Last Modified: 2013-12-13
I am building a nav menu using the wp_list Pages tag and it works well but at the second level I have categories and posts. the categories display but not the posts.  What am I doing wrong.
<div id="main_menu">

                   <div class="wrap">

                       <ul>

                           <?php wp_list_pages('title_li=&child_of=0&depth=1'); ?>

						   <li><a href="<?php bloginfo('url'); ?>/about-us">About Us</a></li>

                        </ul>

                    </div>

                </div>

                <!-- main_menu end -->

                </div>

                

               <div class="column col03">

                <!-- year_menu start -->

                 <div id="year_menu">

                 	<div class="sensorUp sensorClear" onmouseover="scroll_Up('year_wrap',this);" onmouseout="scrollStop(this);"></div>

                 	<div class="wrap">

                 		<div id="year_wrap">

	                       <ul>

	                            <?php global $post; $tid = $post->ID; wp_list_pages('title_li=&child_of='.get_topmost_parent($tid).'&depth=1&sort_order=desc'); ?>

	                        </ul>

                        </div>

                    </div>

                 	<div class="sensorDown sensorClear" onmouseover="scroll_Down('year_wrap',this);" onmouseout="scrollStop(this);"></div>

                </div>

                <!-- year_menu end -->

                </div>

                

               <div class="column col04">

                <!-- sub_menu start -->

                 <div id="sub_menu">

                 	<div class="sensorUp sensorClear" onmouseover="scroll_Up('sub_wrap',this);" onmouseout="scrollStop(this);"></div>

                 	<div class="wrap">

                 		<div id="sub_wrap">

	                       <ul>

	                            <?php 

									

									if (get_topmost_parent($tid) !== 0) {

										if ($post->parent_id !== 0) {

											wp_list_pages('title_li=&child_of='.$post->parent_id.'&depth=1'); 

										} else {

											wp_list_pages('title_li=&child_of='.$tid.'&depth=1'); 

										}

									}

								?>

	                        </ul>

	                    </div>

                    </div>

                 	<div class="sensorDown sensorClear" onmouseover="scroll_Down('sub_wrap',this);" onmouseout="scrollStop(this);"></div>

                </div>

Open in new window

0
Comment
Question by:NGTLD
2 Comments
 
LVL 19

Accepted Solution

by:
NerdsOfTech earned 500 total points
ID: 24846994
try removing depth parameters
<div id="main_menu">

                   <div class="wrap">

                       <ul>

                           <?php wp_list_pages('title_li=&child_of=0&depth=1'); ?>

                                                   <li><a href="<?php bloginfo('url'); ?>/about-us">About Us</a></li>

                        </ul>

                    </div>

                </div>

                <!-- main_menu end -->

                </div>

                

               <div class="column col03">

                <!-- year_menu start -->

                 <div id="year_menu">

                        <div class="sensorUp sensorClear" onmouseover="scroll_Up('year_wrap',this);" onmouseout="scrollStop(this);"></div>

                        <div class="wrap">

                                <div id="year_wrap">

                               <ul>

                                    <?php global $post; $tid = $post->ID; wp_list_pages('title_li=&child_of='.get_topmost_parent($tid).'&sort_order=desc'); ?>

                                </ul>

                        </div>

                    </div>

                        <div class="sensorDown sensorClear" onmouseover="scroll_Down('year_wrap',this);" onmouseout="scrollStop(this);"></div>

                </div>

                <!-- year_menu end -->

                </div>

                

               <div class="column col04">

                <!-- sub_menu start -->

                 <div id="sub_menu">

                        <div class="sensorUp sensorClear" onmouseover="scroll_Up('sub_wrap',this);" onmouseout="scrollStop(this);"></div>

                        <div class="wrap">

                                <div id="sub_wrap">

                               <ul>

                                    <?php 

                                                                        

                                                                        if (get_topmost_parent($tid) !== 0) {

                                                                                if ($post->parent_id !== 0) {

                                                                                        wp_list_pages('title_li=&child_of='.$post->parent_id); 

                                                                                } else {

                                                                                        wp_list_pages('title_li=&child_of='.$tid); 

                                                                                }

                                                                        }

                                                                ?>

                                </ul>

                            </div>

                    </div>

                        <div class="sensorDown sensorClear" onmouseover="scroll_Down('sub_wrap',this);" onmouseout="scrollStop(this);"></div>

                </div>

Open in new window

0
 

Author Comment

by:NGTLD
ID: 24849429
Thanks man
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now