WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Featured Image
[resolved] what is the code for individual featured images? (2 posts)

  1. DhanyaAbraham
    Member
    Posted 7 months ago #

    Hi

    I am using your plugin.But I need some custom settings , I have 3 buttons below each post, if I click on the first button ,1st featured image should come, then 2nd button 2nd image and so on. Shall I know is it possible with this plugin?

    How to call individual images using this function?

    <?php if( function_exists('dfi_get_featured_images') ) {
    $featuredImages = dfi_get_featured_images();?>

    http://wordpress.org/plugins/dynamic-featured-image/

  2. Ankit Pokhrel
    Member
    Plugin Author

    Posted 7 months ago #

    Hi,

    Thank you for checking out the plugin. The data returned by the function is in the following format:

    array
      0 =>
        array
          'thumb' => string 'http://your_site/upload_path/yourSelectedImage.jpg' (length=50)
          'full' => string 'http://your_site/upload_path/yourSelectedImage_fullSize.jpg' (length=69)
          'attachment_id' => string '56' (length=2)
      1 =>
        array
          'thumb' => string 'http://your_site/upload_path/yourSelectedImage.jpg' (length=50)
          'full' => string 'http://your_site/upload_path/yourSelectedImage_fullSize.jpg' (length=69)
          'attachment_id' => string '57' (length=2)
      2 => ...

    So if you like to get the images individually you can do something like this:

    $returnedArray[0]; //will give you the first image
    $returnedArray[1]; //will give you the second image
    $returnedArray[2]; //will give you the third image

    and so on

    Thanks,
    Ankit

Reply

You must log in to post.

About this Plugin

About this Topic