Ellen
Ellen

Reputation: 13

display multiple feature images through custom post type with shortcode

I have a shortcode/multiple feature image problem I'm hoping for a bit of help on.

My custom post type called rubow_medarbejder is displayed on a page with a shortcode. This works fine. I need to add a second feature image. I've used the Multiple Featured Images plugin to do this. Problem is I can't get the image to display through my shortcode.

kd_mfi_get_featured_image_id() shows the id perfectly but when I type kd_mfi_get_featured_image() it brings this error message

Fatal error: Call to undefined function kd_mfi_get_featured_image() in /var/www/www.rubowarkitekter.dk/www/wp-content/plugins/Medarbejdere/medarbejdere_post_type_shortcode.php on line 22

The output part of my shortcode that provokes this error looks like this

$output .= '
        <div id="medarbejder">
                    <div id="medarbejder-page-content-gray">' . kd_mfi_get_featured_image( 'hover-medarbejder-image-grayscale', 'rubow_medarbejder') . '</div>
                    <div id="medarbejder-page-content-img">' . get_the_post_thumbnail() . '</div>
                    <div id="medarbejder-page-content-navn">' . $meta['rubow_medarbejder_navn'][0] . '</div>
                    <div id="medarbejder-page-content-titel">' . $meta['rubow_medarbejder_titel'][0] . '</div>
                    <div id="medarbejder-page-content-telefon">' . $meta['rubow_medarbejder_telefon'][0] . '</div>
                    <div id="medarbejder-page-content-mail">' . get_the_content() . '</div>
        </div>
    ';

Any hints to get this solved would be highly appreciated. Thanks!

Upvotes: 0

Views: 1126

Answers (1)

Sibin Grasic
Sibin Grasic

Reputation: 714

Use Advanced Custom Fields plugin. Then add as much custom fields as you need. and use

echo get_field('my-other-featured-image');

To output.

You need to select image url and size in plugin to output like that.

Upvotes: 1

Related Questions