Display child pages in a parent page? [closed]
I believe you’re looking for this: get_page_children() That function will return an array of your sub-pages, which you can iterate through to display your list.
I believe you’re looking for this: get_page_children() That function will return an array of your sub-pages, which you can iterate through to display your list.
Try using get_post_ancestors. Here is how you can apply this in your case: <?php global $wp_query; $post = $wp_query->post; $ancestors = get_post_ancestors($post); if( empty($post->post_parent) ) { $parent = $post->ID; } else { $parent = end($ancestors); } if(wp_list_pages(“title_li=&child_of=$parent&echo=0” )) { wp_list_pages(“title_li=&child_of=$parent&depth=1” ); } ?> You’ll probably need to remove the depth parameters to show you’re 3rd … Read more
You can use the page_attributes_dropdown_pages_args filter to remove whatever you want. It’s based off of the wp_dropdown_pages() arguments so you can use the exclude parameter to remove certain pages or a fake parent to remove all the pages: /** * Filter the arguments of Page Attributes Parent Dropdown * * @param Array $args – List … Read more
This is how you can get the post object of a page with a matching path, minus the /en part: $page_path = get_page_uri( get_queried_object_id() ); // en/page/child-page $target_page_path = str_replace( ‘en/’, ”, $page_path ); // page/child-page $target_page = get_page_by_path( $target_page_path ); // WP_Post of target page.
Assuming you’re doing this from inside the Loop, you can get it this way: global $post; $page_slug = $post->post_name; Then just use echo $page_slug; in the location(s) you which to have it displayed. For outside the loop, you will need to use different code: $the_page = sanitize_post( $GLOBALS[‘wp_the_query’]->get_queried_object() ); $slug = $the_page->post_name;
The easiest way is to create a page with slug tender and create another page with slug trade and set tender as the parent page. Have a look at this article. And the complicated way is to add a new rewrite rule.
Much of the code for any page, including header and footer, comes from your theme. If you want to create fully custom code, your best bet is to create a child theme (which just means creating a “style.css” file with some comments that refer to the parent theme, which is what you’re currently using) and … Read more
The only difference between a page and a subpage is that a subpage contains it’s parent in the URL, as will any pages that sit as children to the child page… For illustration. Regular page: example.com/a-page/ Subpage: example.com/a-page/a-child-page/ Sub Subpage: example.com/a-page/a-child-page/another-child/ and so on… Aside from the URL there’s no other differences i can think … Read more
If you don’t want a list of Pages, then why are you calling wp_list_pages() in your code? that function returns a list of Pages. You probably need to use get_posts() instead, and then loop through the results to output whatever $post content you want to display. e.g. you could do something like the following: <?php … Read more
I am new to BuddyPress so I don’t know which functions and variables to use here. Read the codex – for example: http://codex.buddypress.org/developer-docs/the-bp-global/ You could create a function in your theme- functions.php or in bp-custom.php and call it from template files and pass it parameters like allowed_users, etc. Or you code hard-code something like this … Read more