Tagged: multiple images
-
AuthorPosts
-
October 23, 2019 at 11:30 pm #1150694
Hello,
I’m not sure this is possible, but I have a client who wants to create entries that have 3 featured images. Then, on the home page, display the most recent entry with all 3 images, the title, and excerpt. My client isn’t really tech-savvy, so the images need to be dynamically loaded into the home page element (similar to what you can do with the Post Slider element, but with 2 additional images). They can be portfolio entries or blog posts, whichever will work the best.
Here’s a link to an example of what I’d like the home page to look like. It’s a full wireframe, but right now I’m just talking about the “Ask an Expert” section with the orange background. https://www.dropbox.com/s/s58x2xpvljfiu8z/caltopo_websiteWireframes_final.jpg?dl=0
I’ve tried tinkering a little, but I can’t seem to figure out how to dynamically serve multiple images from a single post.
Thank you in advance for any help you can provide!
October 27, 2019 at 7:27 pm #1151603Hey Jessica,
Sorry for the late reply, unfortunately we don’t have a way to do this within the theme, but I would recommend creating a custom post type for this so you can assign the 3 images. Here is a good article to get you started.Best regards,
MikeOctober 31, 2019 at 7:49 am #1152627Thank you, Mike! That has gotten me on the right track. I have created the custom post type and added two additional featured images. My only question now is where to put the extra bit of PHP to call the additional images in the theme? It would be something to the effect of:
<?php echo wp_get_attachment_image(get_post_meta( $post_id, 'second_featured_image', true),'thumbnail'); ?>
Thank you!
October 31, 2019 at 10:59 am #1152650Hi,
Glad that this helped, you will want to create a template for your new CPT and add it to your child theme, you can copy the current single.php template which is for single posts or page.php, for pages. I recommend checking out some videos on YouTube.
From looking at your wireframe I believe that your CPT would work well as a shortcode, allowing you to place it in a specific section on your page. Besides checking YouTube, this article may also help.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.