Sticky not working

Home Forums Calendar Products Events Calendar PRO Sticky not working

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1282807
    skynet
    Participant

    Hello,

    We have set an event sticky on the month view, but it not showing first on the month.

    Also how can we get a sticky event via query so we will just show a sticky event to our home page??

    We have try a below PHP code but not working.

    $sticky = get_option( ‘sticky_posts’ );
    $args = array( ‘numberposts’ => ‘2’,’post_status’ => ‘publish’, ‘post_type’ => ‘tribe_events’,’post__in’ => $sticky, ‘ignore_sticky_posts’ => 1);
    $sticky_posts = wp_get_recent_posts( $args );

    #1282893
    Nico
    Member

    Hi there @skynet,

    Thanks for getting in touch with us! I can help you here 🙂

    We have set an event sticky on the month view, but it not showing first on the month.

    This option should ensure the event is shown in month view when there are many events and some of them don’t get into the list. It doesn’t mean it will show first!

    Also how can we get a sticky event via query so we will just show a sticky event to our home page?

    This is not easily doable as ‘Sticky in month view’ relies on the ‘menu_order’ post value (a column in the posts table) and not the same ‘sticky’ value to make a post/page sticky. A workaround is to query events and order them by ‘menu_order’ this will make stickies come first, so following this logic you could do something like this:


    // Grab events by menu_order this will make 'stickies in month view' go first
    $events = tribe_get_events( array(
    'orderby' => 'menu_order'
    ) );

    foreach ( $events as $post ) {
    setup_postdata( $post );

    // if this is true then we are out of 'sticky' in month view events
    if ( $post->menu_order != -1 ) break;

    // this is a sticky in month view let's print it
    echo $post->post_title . '<br>';

    }

    Please let me know if this helps,
    Best,
    Nico

    #1292861
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Sticky not working’ is closed to new replies.