I am using the plugin "Custom Post Types" to create an issue based magazine, where one of my types is "Covers." There will be one of these posts for each issue and will include the cover art and an list of articles in the issue. My question is, how can I make the main page default to display a single view of the newest post of this type?

1 Answer 1


Create a front-page.php file in the theme and query for the latest post of your post type.

$args = array(
  'post_type' => 'yourtypename',
  'posts_per_page' => 1,
  'ignore_sticky_posts' => true,
  'post_status' => 'publish',
$latest = new WP_Query($args);
if ($latest->have_posts()) {
  while ($latest->have_posts()) {
    // etc

See the Template Hierarchy for information about files that are "automagically" loaded..

  • 1
    You've got an extra , at 'posts_per_page', => 1,, which I suspect will cause problems.
    – Pat J
    Jul 4, 2013 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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