[Closed] How to create a View of images

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Caridad 7 years, 2 months ago.

Assigned support staff: Caridad.

Author
Posts
#30302

We want to create a view of latest images that we have uploaded via Media.
The specifications is a 3 column grid displaying a total of 6 images (not posts or links to posts) at once.

What we got so far is:
View Query: Media, ordered by post date, descending, limit to 6 items
View Layout: Grid, columns 3

How do we render the images in a specific size?

Thank you in advance for your assistance

#30363

Dear Loannis,

You need to add a field to that View. The field you need to add to display media is the body field, with no Content Template selected.

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#30366

I added the body field and it displays the image linked to the media post. Is there a way to create a view template for that media post that displays only the image at a certain size?

Thank you in advance

#30605

Dear Loannis,

You will have to create your own shortcode for this. Try adding this code to functions.php in your theme:

add_shortcode('wpv-attachment-image', 'attachment_image_shortcode');
function attachment_image_shortcode($atts) {
  global $post;
  return wp_get_attachment_image($post->ID, 'medium');
}

Now you can use the [wpv-attachment-image] shortcode in the Meta HTML of your View.

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

The topic ‘[Closed] How to create a View of images’ is closed to new replies.