WordPress.org

Ready to get started?Download WordPress

Forums

Slideshow
[resolved] Slideshow not showing (7 posts)

  1. juergreh
    Member
    Posted 1 year ago #

    Hi again

    There might be a simple solution to this but I am just stuck with that at the moment.

    I am pasting the following line into my post
    [slideshow_deploy id=93]

    and then on the index i output the post with the following chunk of code
    $post = get_post($p); //$p is the post_ID
    echo $post->post_content;

    If i do this i only get the string ([slideshow_deploy id=93]) printed onto the page and the slideshow is not initiated.

    I have found a workaround for now by just pasting the slideshow ID into the post (93) and then use the following chunk of code to initiate the slideshow
    $post = get_post($p); //$p is the post_ID
    do_action('slideshow_deploy', $post->post_content);

    It would be desirable though to get it working with the first method

    Thanks

    http://wordpress.org/extend/plugins/slideshow-jquery-image-gallery/

  2. Stefan Boonstra
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    To show a slideshow in a post or page you use the shortcode [slideshow_deploy id=93], which you do correctly.

    To show a slideshow anywhere but a post or a page however, you should always use <?php do_action('slideshow_deploy', $p); ?>. (Where '$p' is the post id variable you mentioned.)

    The way it's working for you now, when doing <?php do_action('slideshow_deploy', $post->post_content); ?>, is that it's actually passing the contents of the post you have [slideshow_deploy id=93] in, to the slideshow deploy action. This will at first look like it works because a slideshow shows up, but the slideshow will be picked randomly because Slideshow expects an ID to be passed.

    Best regards,
    Stefan

  3. juergreh
    Member
    Posted 1 year ago #

    Hi Stefan

    Right now, with do_action('slideshow_deploy', $post->post_content); I actually passing the slide show ID (93) as $post->post_content, and not the whole string [slideshow_deploy id=93].

    I understand it should work by using [slideshow_deploy id=93] as the content of the post but somehow when outputting the post with

    $post = get_post($p); //$p is the post_ID
    echo $post->post_content;

    it doesn't initiate the slideshow but only shows this string "[slideshow_deploy id=93]". I guess my output method is not happy with the slideshow string.

    Thanks

  4. Stefan Boonstra
    Member
    Plugin Author

    Posted 1 year ago #

    So I understand you have a post that you load into $post, which has the number '93' in its $post->post_content?

  5. juergreh
    Member
    Posted 1 year ago #

    correct.

    are you aware of any differences of how the slide show initiates if i output with

    $post = get_post($p); //$p is the post_ID
    echo $post->post_content;

    or with

    query_posts( array ( 'category_id' => $cat, 'posts_per_page' => 1 ) );
    while ( have_posts() ) : the_post();
    	the_content();
    endwhile;

    The 2nd method outputs it correctly, but I changed the page to retrieve the post via post_id so I wanted to use the first method

  6. Stefan Boonstra
    Member
    Plugin Author

    Posted 1 year ago #

    The first method will get all its data straight from the database, while the second makes all data go through the WordPress functions first. As a consequence of that, shortcodes are also handled in the second method. The first method will just print the shortcode literally.

    But since the post has '93' as its post_content, don't they both just print the same?

  7. juergreh
    Member
    Posted 1 year ago #

    Thanks for the explanation, that makes sense.

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.