Every screenshot (or video) in the gallery has it's own individual page. You get to them easily, just by clicking the image itself. We want to make this page as compelling to visit as possible. We'll work on that in some upcoming videos, but for now let's make sure the individual pages at working in WordPress and using as much from the other gallery templates as possible.

The file we are working with is single-screenshot.php - which is named very specifically. Just like single.php controls individual blog posts (WordPress will use this template automatically), single-screenshot.php controls the individual gallery posts. WordPress also uses this template automatically because of the name. "screenshot" is the name of our custom post type.

We add pagination to these single pages via some next_post_link and previous_post_link. We place them in the gallery bar navigation include with some logic so that they only appear on single pages.

We extend the breadcrumb navigation at bit by adding the title of the screenshot.

We have plenty to work with now as we move into designing for this page.


  1. Scott Lyttle
    Permalink to comment#

    Hey Chris,

    For your pagination issues you could also try:

    <?php if ( is_page_template('single-screenshot.php') ) { ?>
        // next and prev links
    <?php } ?>

    as an alternative to is_single()

Leave a Comment

Posting Code

We highly encourage you to post problematic HTML/CSS/JavaScript over on CodePen and include the link in your post. It's much easier to see, understand, and help with when you do that.

Markdown is supported, so you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences like this:

  function example() {
    element.innerHTML = "<div>code</div>";

We have a pretty good* newsletter.