Multipe loop wordpress

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 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

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
  3. Add a name for your query in the “Custom WP Query name” input box - this will differentiate it from the main loop
  4. Enter your query parameter - I kept this simple and said to retrieve the last 10 published posts
  5. Next, with the element still selected, choose “The Post Thumbnail” from the WordPress Actions panel

    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:

    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
1 Like

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!

1 Like

also found this older document:


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