I have created a child theme for Twenty Thirteen. I want to have a separate page called authors-blog that uses a template called blogSummaryPage that displays excerpts from the category "blog". I already know how to get the categories I want, but I can't figure out how to display excerpts on this one specific page using this template.

It would be nice just to be able to edit the content.php for the search, archive, single page, etc., but I'm not sure how to target that specific page.

Here's the page I want to excerpt: http://dakreilein.com/development/authors-blog/

  • 1
    So to be clear, the question is how to use this template for one specific page? I'm not sure if you are asking how to get the page to use that template or how to get the excerpts with that template. – jdm2112 Aug 15 '16 at 21:13
  • I am already using a template for one specific page and I want it to act like the search.php -- except I don't want to display the "Search Results for: ". In the content.php file, the excerpt is done for the search page (if is_search), the archive page and I forget what the other page is. I could get the result I wanted if I could somehow check for the page-name or page id or something like that in content.php. – Jlgtamar Aug 15 '16 at 21:32
  • Oh -- and I am checking for a category of "blog" to limit the posts only to that category. – Jlgtamar Aug 15 '16 at 21:33
  • So the answer to the question is....? – jdm2112 Aug 15 '16 at 21:39
  • 1
    How to get excerpt on a template? the_excerpt() – ngearing Aug 16 '16 at 1:21

The following code will query the "blog" category for the latest three published posts and loop through these results to display the excerpt from each.

$args = array(
    'category_name' => 'blog',
    'post_status' => 'publish',
    'posts_per_page' => 3,

$blog_posts = new WP_Query( $args );

if ( $blog_posts->have_posts() ):
    while ( $blog_posts->have_posts() ): 

        // Do stuff with each post
        echo get_the_excerpt() . "<br>";


WordPress Codex is a great resource for WP development. The WP_Query class is incredibly powerful and well-documented here: https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.