Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wordpress wp_list_pages  show categories and posts as children

Posted on 2009-07-13
2
Medium Priority
?
689 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
NerdsOfTech earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

610 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