Query to get images from database (3 posts)

  1. emaarkhan
    Posted 3 years ago #

    I am trying to make a template page, where i have couple of excerpt from different pages (which i found on net) but now i want to get the thumbnails related to that page, how do i do that and if i want to learn like writing my own queries. how would i do that?

  2. michael.mariart
    Posted 3 years ago #

    Have a look at the get_posts() function. That will let you query the DB for attachments for a post.

  3. emaarkhan
    Posted 3 years ago #

    I did created a query like this
      'orderby' =>'parent',
      'order' =>'asc',
      'post_type' =>'page',
      'post__in' => array(8,14,17,19,21,23,25,27),
       $page_query = new WP_Query($args);

    the var dump produces a image. but when i remove var dump nd make it echo it doesnt

Topic Closed

This topic has been closed to new replies.

About this Topic