• Resolved melanino

    (@melanino)


    I’m using the plugin and it works well. uttavia I would like instead of ordering posts from the oldest to the newest, order from the newest to the oldest. How can I do?

    • This topic was modified 6 years, 9 months ago by melanino.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Steve Grunwell

    (@stevegrunwell)

    Hi @melanino,

    You might consider looking at the “stickytax_get_sticky_posts_for_term” filter, which lets you modify the post IDs that are sticky for each term.

    Assuming newer posts will have a higher ID, you could sort the list of IDs in descending order, using something like PHP’s rsort() function:

    In your theme’s functions.php file, you might try the following:

    /**
     * Sort the Sticky Tax posts in descending order, based on ID.
     */
    add_filter( 'stickytax_get_sticky_posts_for_term', 'rsort' );
    • This reply was modified 6 years, 8 months ago by Steve Grunwell. Reason: Code formatting
    • This reply was modified 6 years, 8 months ago by Steve Grunwell. Reason: Code formatting
    • This reply was modified 6 years, 8 months ago by Steve Grunwell. Reason: Code formatting...again
    Thread Starter melanino

    (@melanino)

    Not found, page not found when add snippet up.

    Thread Starter melanino

    (@melanino)

    I solved with this snippet in functions.php:

    function ordina_sticky( $post_ids ) { 
     krsort($post_ids);
     	return $post_ids;
    }
     add_filter( 'stickytax_get_sticky_posts_for_term','ordina_sticky' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sticky in order last update’ is closed to new replies.