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. User Avatar
    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!

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.