Show Thumbnails of a particular wordpress page

1

I'm developing a theme for wordpress and I created a custom page, I gave the file name of page_vans.php when I'm going to create a page in the dashboard I have the template option that appears for me to choose and it appears that page page_vans.php basically What I want to simplify is.

I want to get only the pages that are created and selected with the page_vans.php template and list the thumbnails of them in the index, if I do a get_page () and list will appear from all pages, I only wanted the pages that are using the custom template (page_vans.php)

    
asked by anonymous 17.08.2017 / 16:27

1 answer

1

The template is saved as a meta_value of the page, you can search like this:

$args = array(
    'post_type'  => 'page', 
    'meta_query' => array( 
        array(
            'key'   => '_wp_page_template', 
            'value' => 'page_vans.php'
        )
    )
);

$paginas = new WP_Query($args);
    
17.08.2017 / 22:47