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
1 answer
938 views

WordPress Side Navigation with Parent Heading and Child Sub Pages

I have the following navigational structure in WordPress: Page Sub Page Child Page Child Page Child Page Page Sub Page Child Page Child Page ...
0 votes
1 answer
790 views

Non page link in wp_list_pages

I would like a navigation something like this. Home - People - About - Services - Contact Home, About, Services and Contact are all pages. People DOES NOT have a page, I would like to use this link ...
0 votes
0 answers
27 views

What's the WordPress way to get custom HTML for child pages list (with a second relative link)? Currently running regex over wp_list_pages() output

I use wp_list_pages() to output all the child pages of the currently viewed page. This works well enough but I wanted to add the comment feed URL with an icon next to each child page. My solution was ...
4 votes
6 answers
5k views

How can I list all pages with their templates?

I want to list all site pages with the template they use. Is there a mod to wp_list_pages which does this?
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. ...
1 vote
1 answer
72 views

Append a code when at the current page in wp_list_pages()

I'm using wp_list_pages() to show pages and subpages in a tree view and I need to add a "read more" as a sub-item right after the current page. Example: We are at the "Page tree" ...
1 vote
2 answers
1k views

$item->url not retrieving url in custom walker?

I've made a custom walker to use with wp_list_pages to modify the output to have thumbnails show. The goal is to have a list show up in a page template, which lists all children with their children. ...
0 votes
3 answers
2k views

wp_list_pages sort order by top nav menu order and child of

Im trying to show a box on left sidebar with links of current page's sub menus. but order is not applying same as menu! whats the problem? <div class="sidebar-box"> <div ...
0 votes
1 answer
633 views

Exclude from wp_list_pages by template

I have a series of "Thank You" pages which result from different form submissions. I would like to be able to exclude these from sitemaps based on their template. Specifically, and as an easy example, ...
2 votes
1 answer
358 views

create shortcode to show children if any otherwise siblings

I'm trying to make a shortcode I can put into a widget that will show the siblings if there are any otherwise show the children. Here is my code I've started with: //sidebar siblings menu function ...
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 ...
1 vote
1 answer
154 views

wp_list_pages to show all pages on all sub pages

I have this code to list my parent page and all pages under it on the sidebar. It shows both parent and child pages on first two levels but when I open a third level page, it only shows the current ...
0 votes
1 answer
174 views

Manually adding current_page_parent to wp_list_pages()

I'm using wp_list_pages() like so: <?php wp_list_pages('title_li=&include=1714'); ?> But would like it so that the link has a current_page_parent class under the following conditions: if (...
0 votes
1 answer
24 views

build child and anchestor three from post parent

I'm trying to build a three menu from a custom post type, and wanna build a complet three from the posts children and parents, with all levels both up and down included. And actually the function ...
0 votes
1 answer
532 views

Change page name in admin list

One of my customer has many pages that have the same titles, although their content is different. They would like to be able to give them "admin titles" in order to differentiate them in the ...
0 votes
1 answer
92 views

wp_list_pages two columns

I have a piece of code that splits my wp_list_pages navigation into two columns: <div id="head"> <ul> <?php $page_s = explode("</li>",...
0 votes
1 answer
392 views

Why are array_slice() and array_chunk() not working?

I'm trying to build a nav out of an array of child pages from a custom post type called "section" with a parameter depth of 1. I want to slice this array so that it only displays a part of ...
0 votes
1 answer
58 views

Retrieve array items without page ID

I am using wp_list_pages to display our website's navigation. The nav is supposed to be 2nd level pages only. I want the nav to display the array's first four items and then nest the rest of the items ...
0 votes
1 answer
246 views

include specific Pages to wp_list_pages with filter

How can i make a simple filter to display only specific pages (include instead of exclude) as an output to wordpress pages widget? I made this code , but its not working function specific_pages($...
0 votes
1 answer
464 views

Get post and its children with WP_Query

I want the parent post and its children posts. I don't know the parent post ID, only that its post_password field is not empty. It's very similar to this question except the post ID is not known in ...
0 votes
1 answer
246 views

Include parent page in list of child pages

I am trying to list pages for a specific ID but want to include the parent page in the list <?php $parent = 83; wp_list_pages( array( 'title_li' => '', 'child_of' =&...
0 votes
1 answer
499 views

wp_list_pages() exclude category

I tried adding this to a similar much older thread but didn't get a response so I am posting it as a new question. I have a large page based website that I am working on. Since it is mainly page ...
0 votes
2 answers
925 views

Using wp_list_pages to create 2 lists of pages and include and exclude some of them depending on their category

I would like to create 2 lists of pages and include and exclude some of them depending on their category. In the following example, I have my 2 lists. A list of promoted pages and a list for the rest. ...
0 votes
1 answer
242 views

Post List by category and under custom taxonomy

I am trying to listing posts from a single category with custom taxonomy and several sub custom taxonomies. sub custom taxonomy "Knowledgebase" post KB 1 post KB 2 sub custom taxonomy "Optimization ...
1 vote
1 answer
113 views

list pages using page.php and NOT page-{slug}.php

I made a view templates for specific slugs page1-220 use page.php contact uses page-contact.php service uses page-service.php Now I want to list the pages with their templates on a "overview" ...
0 votes
1 answer
857 views

Inset image thumbnail from page into list

I currently have 10 child pages which each contain one main image and text. I then have the main parent page, which acts as a 'contents page'. I currently have this code on the main parent page... ...
0 votes
1 answer
541 views

wp_list_pages get the hole hierarchy for current page

Having for example the following page hierarchy Page1 - SubPage1_1 - SubPage1_2 -- SubSubPage1_2_1 Page2 - SubPage2_1 - SubPage2_2 -- SubSubPage2_2_1 and requesting for example ...
1 vote
3 answers
1k views

wp_list_pages() but only show children on the branch you are on

Lets say I have this menu: Top |___ Sub 1 |___ Sub Sub 1 |___ Sub Sub 2 |___ Sub Sub 3 |___ Sub Sub 4 |___ Sub 2 |...
0 votes
1 answer
396 views

Exclude certain template from wp_list_pages

I'm trying to do something similar to the question in Exclude pages with certain template from wp_list_pages, but the $exclude variable doesn't seem to be returning the _wp_page_template value to then ...
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 ...
2 votes
1 answer
705 views

Adding span tags within wp_list_pages list items

I am using this shortcode to produce a list of child pages of a specified parent. I would like to replace the list items default discs with a font awesome icon. According to the font awesome ...
0 votes
1 answer
751 views

Display custom post types in wp_list_pages

I have a sidebar that displays parent, child and grand-child pages if they exist, I would like this to work on my custom post types. I have the following custom post types set up: Events, Blog & ...
1 vote
1 answer
306 views

How to get specified parent page title in my function

Below I have a function that prints the child pages of a parent. I am trying to obtain the specified parent pages title as a h2 above the unordered list. I have tried updating the title_li and also ...
1 vote
1 answer
2k views

List child pages of specific page using shortcode

I have written the function below to list the current pages child pages. Now what I am trying to do is list the children of a specific page using its slug in the shortcode. Is it possible to sneak an ...
0 votes
1 answer
3k views

How to display list of child pages with parent in wordpress?

I have following format of sub-pages in WordPress: About Us -Services -Products -Surgery I want to list all sub-pages with parent page like above but the code that I am using from ...
1 vote
1 answer
27 views

Custom category listings

Maybe the question is stupid sorry - I'm a beginner when it comes to WordPress. But... What do I have to do to have a separate page listing for articles from a given category? Do I need a special ...
0 votes
1 answer
44 views

Creating navigation out of specific IDs and their children?

I'm looking for a way to list three specific pages in a nav-menu (I want to get these pages by their unique page ID's), and also list the children of these three pages - appended to each list item, in ...
1 vote
1 answer
601 views

Add anchor text to php

I am using this code to display a list of child pages of a parent: <?php global $post; // Setup the global variable $post if ( is_page() && $post->post_parent ) { // Make sure we ...
0 votes
1 answer
447 views

Create a list of pages excluding children of selected page

I am looking to find a way to create a list of the IDs of children pages from a selected page. My goal is to use the list of IDs so that I can exclude them from the following function: wp_list_pages(...
0 votes
1 answer
4k views

How To List Sibling Pages And Include The Featured Image?

I recently came across this cool tutorial on listing sibling pages. Below is the suggested code: <?php //GET CHILD PAGES IF THERE ARE ANY $children = get_pages('child_of='.$post->ID); ...
0 votes
1 answer
554 views

Check if the child page has sibling pages, and bookmark current page

I already check if the secondary page has sister pages and I show it in a list of sister pages within each secondary page, but when I am inside a sister page, in the list where I show it I want to ...
2 votes
1 answer
2k views

Check whether the child page has siblings

Is there a way to check whether the child page has sibling pages. That is, whether they belong to the same parent page. If so, display the list of siblings pages within each child page. Example: ...
1 vote
1 answer
2k views

Show siblings (if any) and parents

My question relates to showing the parents and siblings of the current page. If I am on level 2 page, I would like to show siblings without their children. If I am on level 3 page, I would like to ...
0 votes
0 answers
49 views

Post list displaying wrong in Chrome and Firefox

I got a weird problem. My post list is displaying very weirdly in Chrome and Firefox. In Internet Explorer it surprisingly works. I guess it easier to show the behaviour with images: This is in ...
0 votes
1 answer
1k views

wp_list_pages Hierarchical Help

So I have been searching online for something that I think is simple to achieve and I am most likely over thinking it. I have found many related articles on the matter but can't seem to get it to ...
1 vote
1 answer
294 views

Combine get_page_by_title to exclude pages from wp_list_pages

I am using get_page_by_title to exclude a few pages from wp_list_pages, my code looks like: <?php $page1 = get_page_by_title('title1'); $page2 = get_page_by_title('title2'); ...
0 votes
1 answer
65 views

Wrap each child and it's grandchildren separately

I need help separating the child pages, this is what I have right now: <ul class="children"> <li class="page_item page-item-54 page_item_has_children"><span>Title of Child1</...
0 votes
1 answer
3k views

How can I list all page titles and IDs?

I currently use an sql query to produce a private page which lists all pages with their id. (It's a quick-check to help exclude some pages from search and site-map.) For easier formatting, I'm ...
0 votes
2 answers
3k views

Add ID to target navigation link

I am using the following code for a navigation bar on a WordPress website: <?php wp_list_pages("title_li="); ?> Which currently spits out some links that look like: <a href="http://yoururl....
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].'"&...

1
2 3 4 5