WordPress.org

Ready to get started?Download WordPress

Forums

Query to get images from database (3 posts)

  1. emaarkhan
    Member
    Posted 1 year ago #

    Hi,
    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
    Member
    Posted 1 year ago #

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

  3. emaarkhan
    Member
    Posted 1 year ago #

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

    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