Solved

Wordpress wp_list_pages  show categories and posts as children

Posted on 2009-07-13
2
683 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

733 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