WordPress.org

Ready to get started?Download WordPress

Forums

Gallery to Slideshow
[resolved] Slideshow doesn't display the_post_thumbnail (6 posts)

  1. joshuamauldin
    Member
    Posted 2 years ago #

    When creating a gallery, I notice that every image will show, except the featured image. I can't find in your code where you exclude it, but I switched your plugin off and saw the featured image in the gallery.

    Can you tell me where I'd go to add that into your code?

    Thanks!

    http://wordpress.org/extend/plugins/gallery-to-slideshow/

  2. joshuamauldin
    Member
    Posted 2 years ago #

    Ok. Here was my attempt at solving:

    I found this line in gallery-to-slideshow-class.php:
    $output = "\n\t<div class=\"gallery-to-slideshow-wrapper\">\n\t\t";

    And right before it, I added:

    $post_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium' );
    $post_thumb_url = $post_thumb['0'];

    Note: you can change out medium for any thumbnail size.

    I then found this line:
    $featured_id = get_post_thumbnail_id( $post->ID );

    And right before that, I added:
    $output .= "<li><a><img src=\"$post_thumb_url\" /></a></li>";

    You may have a more elegant solution, but there's my stab.

  3. Matt
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Joshuamauldin,

    Adding a new filter hook on next version to modify this behavior.

    Kind Regards!

  4. vasilescu_anton
    Member
    Posted 2 years ago #

    It seems like you've added the filters but I am not sure how to use them... How would I go about displaying the featured image and removing the header?

    Thank you,
    Anton

  5. vasilescu_anton
    Member
    Posted 2 years ago #

    I found how to do it in another post. Here it is in case somebody else needs this info:

    add_filter( 'mv_gallery_to_slideshow_header', 'my_custom_gallery_header' );
    function my_custom_gallery_header( $output ) {
        return '';
    }
    add_filter( 'mv_gallery_to_slideshow_featured_id', 'my_custom_gallery_featured' );
    function my_custom_gallery_featured( $output ) {
        return '';
    }
  6. Matt
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks vasilescu_anton!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic