PressTigers

How to Add Multiple Featured Images for a Custom Post Type

WordPress supports only one featured image by default for a custom post type or default post. But you can extend it to display multiple featured images as per your requirement.

Sometimes, you may want to display more than one featured image. Let’s assume you want to display a slideshow of a specific car (here, car is a custom post type). Some libraries and plug-ins can do it for you; the most common among them is “Multiple Post Thumbnails”. You need to extract its files and then include them in your Theme.

After that, you need to upload some additional featured images and associate them with the custom post type by using the following code:

You have successfully added support for three featured images to your ‘cars’ custom post type. Use the following code to get the image source at the front-end:

After getting the image source for all the featured images, pass them onto a slider or carousel accordingly.

User Comments

2 thoughts on “How to Add Multiple Featured Images for a Custom Post Type

    Aditya Gupta says:

    i use this code for multiple featured image for custom post type but its not working..

      Azeem Afzal says:

      Hi Aditya,

      Just to be clear have you installed “Multiple Post Thumbnails” plugin? if not then this code is not valid without that.
      Make sure the plugin is updated.

      Let us know if you need further assistance.

      Regards,

      Azeem | Client Service Executive
      Email: support@presstigers.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Get in Touch