Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ivanbohatyr

    (@ivanbohatyr)

    Thanks for swift reply, the code I posted was simplified to focus only on this issue, so staff like global $post I ommited on purpose (seemsed to be insignificant).

    But back to the topic – that’s it, using WP_Query() instead of get_posts() solved the problem!

    I usually use WP_Query() when varied agruments are needed, so I thought in this case get_posts() is enough, but that was wrong…

    I really appreciate your help, thanks again.

    Thread Starter ivanbohatyr

    (@ivanbohatyr)

    Yes, exactly -> data-slb-group attribut now is added directly to the link – see the code below.

    It my own shotcode, here is the part regarding this issue (code is simplified):

    $posts = array_reverse(get_posts( $args ));
    foreach ( $posts as $post ) {
      setup_postdata( $post );
      $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
      //first thumbnail<br />
      $output .= '<a href="' . $full_image_url[0] . '" title="' . the_title_attribute('echo=0'). ' | ' . $title . '">'.get_the_post_thumbnail(get_the_ID(), array(220, 170)).'</a>';
      if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail(get_post_type(), $seq.'-image', get_the_ID())) {
        //adding other thumbnails - like the first one
      }
    }
    wp_reset_postdata();

    And I want to make separate slideshows for each post.

    Thread Starter ivanbohatyr

    (@ivanbohatyr)

    Well, I work on this wordpress site within a company, so I rather do not public the url of this development site, on real site it’s now done by data-slb-group as I posted.

    In functions.php there is a function that prints all posts in one category, each post has few thumbnails (by multiple thumbnails plugin). Via shortcode this function is invoked in a page. By get_posts() and get_the_post_thumbnail() all the thumbnails are displayed. Now I want to slideshow only these thumbnails, that are from one post. Problem is, that this (otherwise awesome) plugin does not recognize that and make slideshow for all thumbnails regardless which post they belong.
    I hope I cleared this issue well.

    Yes, “Group items by Post” is enabled, but just first option “Group items” has effect, others checked/unchecked has no effect in this case.

    I admit, that with new version data-slb-group attribut can change and actual solition will break, but I have no better solution yet.

    Thank for your time.

    Thread Starter ivanbohatyr

    (@ivanbohatyr)

    Solved…

    to group images for slideshow do this: set ‘data-slb-group=”<?php echo $id ?>”‘ (where $id is id of your slideshow – post_ID perhaps) to wrapping ‘a’ tag on each image.

    So instead of trying some ‘rel=lightbox[slideshow1]’ try ‘data-slb-group=”slideshow1″‘ (set on ‘a’ tag, not ‘img’).

    Something like that could work:
    <a ... data-slb-group="<?php the_ID() ?>" data-slb-active="1" data-slb-internal="0"><img ...></a>

Viewing 4 replies - 1 through 4 (of 4 total)