Can someone explain to me where in the Twenty Seventeen theme in the static homepage is it directed to do a loop of pages rather than posts?

I don't understand where it is doing this, from a fresh WordPress install.

In front-page.php I have this:

        // Get each of our panels and show the post data.
        if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) : // If we have pages to show.

             * Filter number of front page sections in Twenty Seventeen.
             * @since Twenty Seventeen 1.0
             * @param $num_sections integer
            $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 );
            global $twentyseventeencounter;

            // Create a setting and control for each of the sections available in the theme.
            for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) {
                $twentyseventeencounter = $i;
                twentyseventeen_front_page_section( null, $i );

    endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here. ?>

But where is the function code for the actual selection and output of these pages? I can't find it.

Furthermore, this code is after what looks like a loop searching for posts, but in the theme, the pages appear before a page labelled Blog that has the posts within it... what's that about?

I want to modify the theme to only pick certain pages so I'm interested in how it is generating the front page sections.

  • 2
    Are you talking about the Front Page Sections in the Customizer?
    – Milo
    May 24, 2017 at 20:24
  • @Milo Maybe the same thing, I'm talking about the pages that appear on the homepage when Twenty Seventeen is set to a static homepage. May 24, 2017 at 20:26

1 Answer 1


The page selection is set within the Customizer under Theme Options, which will only show when front page is set to static.

The output happens within the function twentyseventeen_front_page_section in the theme file template-tags.php, where each panel is queried individually with get_post, so it's not exactly a loop in the conventional sense.

You can change the number of sections from the default 4 with the twentyseventeen_front_page_sections filter, which should return the number of desired sections.

To access the values via code, you can use get_theme_mod, each panel is stored under the key panel_$i, where $i is the section number, starting at 1. The stored value is the ID of the page. You can also update these values with set_theme_mod.


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.