• Resolved oobmak

    (@oobmak)


    Hello

    Thanks for your plugin.

    I need to show the related posts in the sidebar widget ordered by date. Is it possible ?

    Regards

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ajay

    (@ajay)

    You can use the widget in your sidebar. But to order by date you will need to add this code into your functions.php

    
    function crp_sort_by_date( $orderby ) {
       return ' wp_posts.post_date DESC';
    }
    add_filter( 'crp_posts_orderby', 'crp_sort_by_date' );
    
    Thread Starter oobmak

    (@oobmak)

    Many thanks. But there’s a syntax error

    The snippet has been deactivated due to an error on line 2:
    syntax error, unexpected ‘&’

    I tried to delete the “&” but I get

    The snippet has been deactivated due to an error on line 3:
    syntax error, unexpected ‘}’

    Regards

    Plugin Author Ajay

    (@ajay)

    where are you getting this error? There is no & in the code above

    Thread Starter oobmak

    (@oobmak)

    That works ! Sorry. I copied from the mail. Thanks

    Thread Starter oobmak

    (@oobmak)

    Plugin Author Ajay

    (@ajay)

    Thanks for confirming.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to order the output ?’ is closed to new replies.