Show the grandmother/father of the childpage

You need to look at get_ancestors() to get the top level parent of a page. Just a note, for reliability, use get_queried_object() (or even better $GLOBALS[‘wp_the_query’]->get_queried_object()) to get the current post/page object on singular pages, $post can be quite unreliable You can try the following in your shortcode: $post = $GLOBALS[‘wp_the_query’]->get_queried_object(); // Make sure the … Read more

Display Tags of Child Pages

I modified my code based on this posting’s answer, and the page displays everything I want now. <div id=”masonry-loop” class = “group”> <?php global $post; $child_pages_query_args = array( ‘post_type’ => ‘page’, ‘post_parent’ => $post->ID, ); $child_pages = new WP_Query( $child_pages_query_args ); if ( $child_pages->have_posts() ) : while ( $child_pages->have_posts() ) : $child_pages->the_post(); ?> <?php $images … Read more

Listing Child Pages in Random order

The sort_column parameter of wp_list_pages() does allow items to be returned in random order using the rand option. sort_column (string) Comma-separated list of column names to sort the pages by. Accepts ‘post_author’, ‘post_date’, ‘post_title’, ‘post_name’, ‘post_modified’, ‘post_modified_gmt’, ‘menu_order’, ‘post_parent’, ‘ID’, ‘rand’, or ‘comment_count’. Default ‘post_title’. add_shortcode( ‘wpb_childpages’, ‘wpb_list_child_pages’ ); function wpb_list_child_pages() { global $post; if … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedueduseduedusedusedueduedusedu