# Multipe loop wordpress

**URL:** <https://forum.pinegrow.com/t/multipe-loop-wordpress/4677>\
**Category:** Pinegrow WP\
**Created:** [November 15, 2020, 4:11pm UTC](https://forum.pinegrow.com/t/multipe-loop-wordpress/4677 "2020-11-15T16:11:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazzel](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mazzel](https://forum.pinegrow.com/u/mazzel)\
**Post date:** [November 15, 2020, 4:11pm UTC](https://forum.pinegrow.com/t/multipe-loop-wordpress/4677/1 "2020-11-15T16:11:15Z")

</div>

Hi  
In single.html (php) I show one post.  
This is the default wp\_query loop for such a page.

In this page I also want to show another loop that shows me for example all featured images from the posts.  
[The Loop « WordPress Codex](https://codex.wordpress.org/The_Loop) describes how to make php multiple loops.  
Does Pinegrow have some sort of Smart Actions to encomplish this too?  
Or should I make PHP blocks (in pinegrow editor)  
If I look at an example from the mentioned codex page:  
\> // going off on my own here

> ```
> <?php $temp_query = $wp_query; ?>
> <!-- Do stuff... -->
> <?php query_posts( 'category_name=special_cat&posts_per_page=10' ); ?>
> <?php while ( have_posts() ) : the_post(); ?>
> <!-- Do special_cat stuff... -->
> <?php endwhile; ?>
> // now back to our regularly scheduled programming
> <?php $wp_query = $temp_query; ?>
> 
> ```

Then maybe I need to put that in PHP smart action blocks and work from there.  
Another solution will be to edit manually the created php file from PG and edit the code in. But this would spoil the usage from PG Editor  
/ Hans

---

<div class="post-metadata">

**Author:** ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)\
**Post date:** [November 15, 2020, 7:50pm UTC](https://forum.pinegrow.com/t/multipe-loop-wordpress/4677/2 "2020-11-15T19:50:08Z")

</div>

Hi @mazzel,  
Pinegrow can do this using WordPress actions - it isn’t a smart action, though.  
So basically, if you just want a grid of the images:

1. add a container to hold them on your page.
2. Add a new loop to your element by clicking on “The Loop” from the WordPress actions panel  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/3/34af51cfe300328bedc811f4ba5d397e480be58b.png)
3. Add a name for your query in the “Custom WP Query name” input box - this will differentiate it from the main loop  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/1/15f3c37acf0a3f3b4ae854ebd3e4ebb03baba3f5.png)
4. Enter your query parameter - I kept this simple and said to retrieve the last 10 published posts  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/4/4db951fd7f2b6fb85304a821585f953e54a0a37d.png)
5. Next, with the element still selected, choose “The Post Thumbnail” from the WordPress Actions panel  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/6/63de53cd2f4fc9681fd7eedae5ddd0739a2cdd19.png)  
This will chain the query along with the ‘get\_post\_thumbnail()’ function
6. Fill in any desired items for the thumbnail.  
This will output the following:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/94b5ac4b9584848b70fed42fac38e615b29364ce.png)  
To add better styling you’ll need to do a bit more work to get the images where you want them, but hopefully this makes sense.  
If you need more help let me know.  
Bob

---

<div class="post-metadata">

**Author:** ![mazzel](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mazzel](https://forum.pinegrow.com/u/mazzel)\
**Post date:** [November 15, 2020, 10:52pm UTC](https://forum.pinegrow.com/t/multipe-loop-wordpress/4677/3 "2020-11-15T22:52:58Z")

</div>

Hi @RobM ,  
many thanks for this, I never realized PG can have custom wp\_query’s beside the global wp\_query.  
and also lots of options in this Wordpress action, just the thing I needed and didn’t find before.  
Greetings!!  
p.s. and yes it works!

---

<div class="post-metadata">

**Author:** ![mazzel](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mazzel](https://forum.pinegrow.com/u/mazzel)\
**Post date:** [November 21, 2020, 12:22am UTC](https://forum.pinegrow.com/t/multipe-loop-wordpress/4677/4 "2020-11-21T00:22:14Z")

</div>

also found this older document:

> **[Create a Loop with a Custom Post Type - Pinegrow Web Editor - Documentation...](http://docsbeta.pinegrow.com/create-a-loop-with-a-custom-post-type/)**
>
> As you have already seen in our WordPress video course, adding a loop is the way to display posts in your WordPress theme. But the standard loop only works for standard post types (pages and posts). Custom post types require some specific settings.

  
just as a reference for myself whenever I need this info later again
