• Resolved dmorrisse

    (@dmorrisse)


    I’ve input the above code. However the image displays as just as .img in css. How can I create this as a new class. My goal is to have this right aligned and act almost as a background per post.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Marcus Kober

    (@marcuskober)

    Hi there,

    sadly, there’s no “above code”…

    So I can just guess what you want to achieve.

    If you want to get the full control of the image tag, you can do so by retrieving just the image src. So you are able to crate the image tag by your own like that:

    <?php
    $imageSrc = kdmfi_get_featured_image_src( 'featured-image-2', 'full' );
    ?>
    <img src="<?php echo $imageSrc; ?>" class="alignright">
    

    Please keep in mind: this is an example! You must include your chosen image id and image size!

    If you are using version 0.5 of the plugin you can use the shortcode too. Let’s assume you want to call it in a theme file:

    
    echo do_shortcode( '[kdmfi_featured_image id="featured-image-2" size="full" class="alignright"]' );
    

    If you are using version 0.5 this would be the easiest way…

    Cheers,
    Marcus

    Thread Starter dmorrisse

    (@dmorrisse)

    Hey Marcus,

    I’ve gotten that part figured out. Is there a way I can get the second featured image to only display on the single post page? Right now it’s displaying on category archive as well.

    So on these pages display the second image: https://abbieagogo.com/test-test-2/

    But on these hide them: https://abbieagogo.com/category/travel/

    Plugin Author Marcus Kober

    (@marcuskober)

    Hi there,

    without seeing any code it’s all guesswork here…

    But I think it should work to wrap the code that displays the image in following if statement:

    if (is_single()) {
      // here comes the code
    }

    See reference of is_single().

    Hope that helps!

    Regards,
    Marcus

    Thread Starter dmorrisse

    (@dmorrisse)

    All set! I got it to work. You are the man!

    Plugin Author Marcus Kober

    (@marcuskober)

    Great!

    If you find the time, a little review of my plugin would be nice. ??

    Regards,
    Marcus

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Setting the 2nd image as a new class’ is closed to new replies.