I have a php snippet that will displayed child pages. And now, I want to displayed only the featured image with the 55 characters of content only (except the title) and put some button. Like this http://bit.ly/1OvYK1b

Here's the snippet:

$my_wp_query = new WP_Query();
                    $all_wp_pages = $my_wp_query->query(array('post_type' => 'page', 'posts_per_page' => -1));

                    $news = get_page_children(2610, $all_wp_pages);

                    foreach(my_get_page_children(2610) as $s){
                        $page = $s->ID;
                        $page_data = get_page($page);
                        $content = $page_data->post_content;
                        $content = apply_filters('the_content',$content);
                        $content = str_replace(']]>', ']]>', $content);
                        echo '<div><span>'; 
                        echo get_the_post_thumbnail($page); 
                        echo '</span><span>'.$content.'</span></div>';

function my_get_page_children($page_id, $post_type = 'page'){
// Set up the objects needed
$custom_wp_query = new WP_Query();
$all_wp_pages = $custom_wp_query->query(array('post_type' => $post_type, 'posts_per_page' => -1));

// Filter through all pages and find specified page's children
$page_children = get_page_children($page_id, $all_wp_pages);

return $page_children;
  • so what is the problem, what do you expect to happen that doesn't? – Mark Kaplun Oct 13 '15 at 6:21
  • I don't want the title to display. And limit the content of each child page to display – user3818821 Oct 13 '15 at 6:24
  • 1
    Hmmm, it sound now like "a please wrtie the code for me" question" :(. This should be basic php stuff. – Mark Kaplun Oct 13 '15 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.