Skip to main content

Questions tagged [wp-list-pages]

This function displays a list of WordPress Pages as links. It is often used to customize the Sidebar or Header, but may be used in other Templates as well.

Filter by
Sorted by
Tagged with
1 vote
2 answers
3k views

Add Parent to List of Subpages

This code works well to display child pages of the parent page while viewing both the parent page and child page. It doesn't apply the current_page_item CSS class to the parent while viewing it (and ...
AndrettiMilas's user avatar
3 votes
2 answers
7k views

Add class to the items in wp_list_pages

I just want to add a class for the active page in the wp_list_pages().Is it possible? If so can I provide a particular class for a active page. Here is my code for listing the parent page and its ...
user2754416's user avatar
1 vote
3 answers
7k views

get all page IDs from wp_list_pages

I am looking for a way to output all page IDs from the following menu: <?php wp_list_pages('depth=1&exclude='3,5,11')); ?> Only top level pages needed, therefore the 'depth=1'. Any help ...
Kolli's user avatar
  • 13
0 votes
3 answers
11k views

Ways to give a wp_list_pages menu link specific class names?

I'm looking to style my wp_list_pages with a span class. I'd like to give it a unique class so that I can give each a specific icon. 'link_before' => '<span class="'.[unique-identifier-here].'"&...
Derek's user avatar
  • 91
0 votes
2 answers
6k views

How to show only parents subpages of current page item in vertical menu?

I just can't find a way to make it possible to show only current parent items down to current page item in a vertical menu the "wordpress way". What I want to achieve is the following dynamic ...
Peter Westerlund's user avatar
8 votes
6 answers
26k views

Return parent post with its children using WP_Query?

In some cases it might be useful to use multiple post & page parameters in your WP_Query object. In my case, I would like to display children of a parent page including the parent page itself. ...
luukvhoudt's user avatar
3 votes
3 answers
5k views

How to hook wp_list_pages?

How can I hook the wp_list_pages function so that it reads a value of a custom field and displays it instead of displaying the page title?
Mohamed Said's user avatar
2 votes
1 answer
2k views

how to properly list child pages in sidebar?

My pages menu is maximum 3 levels deep and I am having a hard time figuring out how to properly list the child pages in the sidebar. If a page is a parent I want to list it's direct child pages and ...
user avatar
1 vote
1 answer
7k views

Change ul class="children" for wp_list_pages?

Hello I'm using this code to print a list of Pages and Subpages: <ul> <?php wp_list_pages('title_li=&depth=2&child_of='); ?> </ul> It outputs: <ul> <li><...
Shirou June's user avatar
1 vote
1 answer
2k views

Display grandchildren on child and grandchild pages using wp_list_pages

On hierarchal pages 3 levels deep, I would like to display the grandchildren on child and grandchild pages (but not on the parent page). What I have so far displays the grandchildren on the child page ...
gstricklind's user avatar
0 votes
1 answer
1k views

Exclude pages with certain template from wp_list_pages

Before you mark this as duplicate I have tried every method in all the other questions and non of them have worked. I am trying to exclude any page with the page template page-noindex.php from the ...
Daniel Vickers's user avatar
0 votes
1 answer
199 views

wp_list_pages - show pages immediately 1 level below current level

I'm setting up an events page in a wordpress site I'm building. Let's take a look at the page menu hierarchy: First of all there is a Events landing page. It will display four regions where events ...
rowefx's user avatar
  • 31
0 votes
1 answer
3k views

Add filter to wp_dropdown_pages() or wp_dropdown_categories() - no select container?

I'm working with wp_dropdown_pages() and wp_dropdown_categories() and both are always outputting a <select>-box with its <option>s as items. Is it possible to add a filter/hook to this ...
mathiregister's user avatar
0 votes
1 answer
448 views

Load parent pages when there are no child pages

I use the following code to load subpages in a sidebar on all pages: <?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1'); ...
rhand's user avatar
  • 352
0 votes
1 answer
4k views

How to add active class to custom menu using while loop and wp_list_pages

I am running wp_list_pages through a while loop to create a custom menu. By running it through a loop I can target specific elements to show. I need to figure out how to either target the classes ...
Heather's user avatar
  • 489