List all files from subpages

My goal is to list all the pages names as well as the "attached files" of these pages on a separate overview page in wordpress. I have 100 pages with each between 0 and 4 attached PDF files (linked inside the content, but could be uploaded as attachement to the page also). The overview page should then list all these pages like this: - page name 1 -- pdf file 1-1 -- pdf file 1-2 [..] - page name 2 …
Category: Web

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 class="sidebar-box-title"> <h4><?php echo get_the_title($post->post_parent); ?></h4> </div> <ul class="links"> <?php wp_list_pages('sort_order=asc&title_li=&sort_column=menu_order&depth=1&child_of='.$post->post_parent); ?> </ul> </div> DEMO: http://www.testhosting.co.uk/speedshealthcare/healthcare-supplies/care-home-pharmacy/
Category: Web

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 Child Page Page Sub Page Child Page Child Page Child Page On each Sub Page and Child Page, I want to display the following in the sidebar: Sub Page Child Page Child Page Child Page The closest I've come to this is the following code from here: <ul> <?php global $post; $current_page_parent = ( $post->post_parent ? …
Category: Web

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 to open a second Navigation. Is it possible to add a link in wp_list_pages that doesn't link to a page. Is it also possible to add a id to this link that doesn't have a page. I would like the code to …
Category: Web

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, excluding them from being listed on the basic 404 page which utilizes the wp_list_pages. I know how to manually exclude by ID but am looking for a better way to do this on scale and a more simplified approach--rather than having to edit code. Is …
Category: Web

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 rt_list_children() { global $post; $page = $post->ID; if ( $post->post_parent ) { $page = $post->post_parent; } $children = wp_list_pages( array( 'child_of' => $page, 'title_li' => '', 'echo' => '0', ) ); if ($children) { $output = '<ul>'; $output .= $children; $output .= '</ul>'; } …
Category: Web

Translate dashboard metabox

I create a dashboard metaboxes for the last published and drafted pages below the code i use : #dahsboard metaboxes #Last edited pages add_action( 'wp_dashboard_setup', 'admin_dashboard_last_edits_register' ); function admin_dashboard_last_edits_register() { wp_add_dashboard_widget( __FUNCTION__, __( 'Last published pages ', 'admin-dashboard-last-edits' ), 'admin_dashboard_last_edits_dashboard_widget'); } function admin_dashboard_last_edits_dashboard_widget() { $posts = get_posts( array ( 'numberposts' => 10, 'post_type' => array ( 'page' ), 'orderby' => 'modified') ); if ( $posts ) { $date_format = get_option( 'date_format' ); echo '<ul>'; foreach ( $posts as $post ) …
Category: Web

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 appreciated.
Category: Web

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 page on the sidebar. How can I modify this to show parent page and all child pages, no matter how many levels of child pages I have. CODE: <?php if ( $post->post_parent ) { $children = wp_list_pages( array( 'title_li' …
Category: Web

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 wp_list_pages()does that really great, and actually includes all levels that i want. But i also want to modify the query a little, and exclude some post that fits within a meta query, that i'm using another place like this: $meta_query[] = array( 'relation' => …
Category: Web

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. Visualization of what I want to achieve. Imagine the following pages hierarchically sorted as following: page A page B Child page A Child page B Child page C page C The bold list items are the posts/pages I want to retrieve. My first thoughts …
Category: Web

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 admin list. I was thinking of adding an ACF extra field "Admin Title". If this field is filled, then on the page listing in the admin, I would like to use it. Is there an admin filter that is called when generating the page list …
Category: Web

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>",wp_list_pages('title_li=&echo=0&depth=1')); $page_n = count($page_s) - 1; $page_col = round($page_n / 2); for ($i=0; $i < $page_n; $i++){ if ($i < $page_col){ $left = $left.''.$page_s[$i].'</li>'; } else if ($i>=$page_col) { $right = $right.''.$page_s[$i].'</li>'; } } ?> <div id="nav"> <div> <?php echo $left; ?> </div> <div> <a href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="Logo" title="Logo" /></a> </div> <div> <?php echo $right; ?> …
Category: Web

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 the array. When I try array_slice() or array_chunk() and then wp_list_pages() to display the pages, it returns everything from the Pages content type and it doesn't split up the array either. What am I doing wrong? <?php $arr = array( …
Category: Web

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 in a "more" dropdown. What I'm trying to do is split the array so that the last few list items can be located in a different HTML tag that contains the more dropdown. To display the first four items, I use 'include', …
Category: Web

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($output) { $args = array( 'include' => array(147,12,32), ); $output = get_posts($args); return $output; } add_filter('wp_list_pages', 'specific_pages');
Category: Web

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' => $parent, ) ); ?> I tried adding 'include' => 83 but then it only listed the parent and not the children.
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.