How to get title from WP_Post Object How to get title from WP_Post Object wordpress wordpress

How to get title from WP_Post Object


Just to be sure, you should use every page data as column name.

For instance,

$page_data->post_content //is true,$page_data->the_title // is false.


Try this one. Giving just idea.

<?php     $post = get_post($_GET['id']);     $post->post_title; ?>


This is from my notes that I got working with your exact situation. Hope it helps.

<?php     $my_wp_query = new WP_Query();     $all_wp_pages = $my_wp_query->query(array('post_type' => 'page', 'posts_per_page' => -1));    $childpg = get_page_children(8, $all_wp_pages);    foreach($childpg as $children){        $page = $children->ID;        $page_data = get_page($page);        $content = $page_data->post_content;        $content = $page_data->the_title;        $content = apply_filters('the_content',$content);        $content = str_replace(']]>', ']]>', $content);        echo '<div class="row-fluid"><span class="span4">';         echo get_the_post_thumbnail( $page );         echo '</span><span class="span8">'.$content.'</span></div>';    }     ?>