Display grandchild page content on parent page

From your question I understand that inside the top level page you want to indicate which child page to include. The obvious way to do this is using a shortcode. So in your functions.php you would have something like this: add_shortcode( ‘insert_child’, ‘wpse240522_insert_child’ ); In the content of your top level page you would have … Read more

My function echos only “array”

You shouldn’t return childpages, you should add variable $ret=””; and in each cycle append foreach(…){ $ret.=”<div…”; } and return it In general you should always return a string(or number) in such functions

Get a page ancestor from a most viewed list

get_ancestors will return array form value. So if you talking about how to get and display that ancestors with link: <?php $arrAncestors = get_ancestors( $post->ID, ‘page’); $cntAncestors = COUNT($arrAncestors); if($cntAncestors > 0) { $parentPostId = $arrAncestors[$cntAncestors – 1]; $parentPageLink = get_permalink($parentPostId); $parentTitle = get_the_title($parentPostId); print ‘<li><a href=”https://wordpress.stackexchange.com/questions/243836/<?php $parentPageLink ?>” title=”<?php $parentTitle; ?>”><?php $parentTitle; ?></a></li>’; } … 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

List child pages, exclude the current page

Looks like a syntax error to me. Try: wp_list_pages(“title_li=&child_of=2143&exclude=$current_post_id”) OR wp_list_pages(“title_li=&child_of=2143&exclude=”.$current_post_id) Also I will suggest to pass parameters as array instead of a string, for better debugging. wp_list_pages( array( ‘child_of’ => 2143, ‘exclude’ => array( $current_post_id ), ); Make sure $current_post_id is giving proper value.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)