Show Thumbnails of a particular wordpress page

Asked

Viewed 23 times

1

I am developing a theme for wordpress and created a custom page, I gave the name of the file page_vans.php when I will create a page on Dashboard I have the template option that appears to me to choose and it appears this page page_vans.php basically what I want to simplify is.

I want to take only the pages that are created and selected with the page_vans.php template and lists their thumbnails 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)

1 answer

1


The template is saved as a meta_value from 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);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.