Slider not following order set in slides

Home Support Business Point Slider not following order set in slides

Tagged: 

This topic contains 4 replies, has 3 voices, and was last updated by  amikron 2 weeks, 5 days ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11830

    amikron
    Participant

    Hi,

    Setting order of slides does not work correctly. They appear to be somewhat random, not in set order nor in post id order.

    Thanks in advance for fixing this 😉

    Adam

    #11931

    Hello Amikron,

    The issue you are facing is already solved in our business point 2.1.2 version.
    Can you please make sure you have installed version theme.
    The issue will be solved you update the theme.

    Please feel free to let us know if you have any further queries.

    Thank you.

    #11949

    amikron
    Participant

    Hi again,

    I’m afraid I had the latest version allready installed, when I submitted this post. I have fixed it myself by adding menu_order as ‘id’ to $output in helpers.php and then sorting over it, but I wouldn’t like to change this code after every update of the theme ;-).

    Best regards,
    Adam

    #15726

    mmconstruction
    Participant

    Same problem here.

    #15742

    amikron
    Participant

    I’ve fixed this on my own. In include/helpers.php in function business_point_get_slider_details you have to add order to output array and then sort the array over it.

    I’m posting whole fragment, so you can easily find changes:

    $posts = get_posts( $query_args );

    if ( ! empty( $posts ) ) {
    $p_count = 1;
    foreach ( $posts as $post ) {
    if ( has_post_thumbnail( $post->ID ) ) {
    $image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ );
    $output[ $p_count ][‘image_url’] = $image_array[0];
    $output[ $p_count ][‘title’] = $post->post_title;
    $output[ $p_count ][‘url’] = get_permalink( $post->ID );
    $output[ $p_count ][‘excerpt’] = business_point_get_the_excerpt( absint($slider_excerpt_length), $post );
    $output[ $p_count ][‘id’] = $post->menu_order; //store order in output array

    $p_count++;
    }
    }
    // sort over it
    foreach ($output as $key => $row)
    {
    $slider_pages[$key] = $row[‘id’];
    }
    array_multisort($slider_pages, SORT_ASC, $output);
    }

    return $output;

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.