How to show attached images looper in a portfolio item

Hi
I am building with Pro & Cornerstone a single layout for portfolio items.
I want to show all images here, that have been attached to this portfolio item (children).
On another website I managed this on a specific page (not layout) by building a looper, targeting the current page children and consumer gives out the images attached to this page by using custom dynamic content “{{dc:post:featured_image}}”.
You can find this page here: https://diesch-gmbh.de/verkehrsmittelwerbung/
Is it possible to to this in a portfolio single layout, too?
Thank you
Best regards,
Hannes

PS: thank you for your fast hotfix concerning WP 6.2

Hello Hannes,

Thanks for writing in!

Yes, you can use {{dc:post:featured_image}} to display the featured image of the portfolio item. To display the attached images of a particular post or portfolio item, you will need to use Looper Provider Query String and use this query argument:

$args = array(
   'post_type' => 'attachment',
   'post_mime_type' => 'image',
   'numberposts' => -1,
   'post_status' => null,
   'post_parent' => $post->ID
);

where in you replace the $post->ID with the dynamic content {{dc:post:id}}. Please check out this related thread to get the actual query string:

Best Regards.

Fantastic.
Thank his is such a great feature of Pro!
Simply amazing.
THANK YOU

You are most welcome Hannes.

To share my solution, here the actual query string to show all attached images of a portfolio item:

post_type=attachment&post_mime_type=image&numberposts=-1&post_status=null&post_parent={{dc:post:id}}

Hi Hannes,

Glad that you shared the solution with others.

Thanks

Is there possibly also a way to show images, that are not attached to the page, but have a certain title?
Something like this?

$args = array(
‘post_type’ => ‘media’,
‘post_mime_type’ => ‘image’,
‘numberposts’ => -1,
‘post_status’ => null,
‘post_title’ LIKE ‘patternfortitlesisearch*for’
);

Hi Hannes,

You can use the following arguments to get the Unattached images.

$args = array(
    'post_type' => 'attachment',
    'post_mime_type' => 'image',
    'numberposts' => -1,
    'post_status' => null,
    'post_parent' => 0
); 

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.