Okay
  Public Ticket #2125835
Sorting / order Wiki post
Open

Comments

  • Sorcim started the conversation

    Hello,

    I'd like to be able to sort my Wikis the way I want. Can I use the "Post Types Order" plugin?

    Otherwise, where can I change the order of the query (ASC to DESC)?

    Thank you very much.

  •  283
    Abhishek replied

    Hello,

    You can sort the wiki using woffice_wiki_query_args filter for example if you want to sort it by date use the filter like 

    function my_woffice_wiki_sortby_date( $args ) {    
            $args['order'] = 'date';
            return $args;
    }
    add_filter( 'woffice_wiki_query_args', 'my_woffice_wiki_sortby_date'  );

    Have a nice daysmile.png

    Kind Regards,

    Abhishek 

    Want feedback on your awesome Intranet? Get yourself a beta access on Feedier.com.

    Keen on Woffice ? Please take a few seconds to give us a 5-star review on ThemeForest.

  • Sorcim replied

    Hello, 

    I tried the filter but no change even by replacing date by title or changing the order ( ASC or DESC)

    I have the feeling that the apply_filter doesn't work (I tried to display text but nothing is displayed.)

    Thanks

    Johan

  •  626
    François replied

    Hello, 

    It should be: 

    $args['order'] = 'ASC'; // Or DESC
    $args['orderby'] = 'post_title'; // Or anything else

    More details can be found here: https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

    Kind Regards,

    François 

    Want feedback on your awesome site? Get yourself a beta access on our new product Feedier.com here: https://feedier.com/

  • Sorcim replied

    Hi, 

    I still have a problem with the filter.

    he doesn't do anything at all.

    here is my code in my functions.php

    function my_woffice_wiki_sortby_title( $args ) {
        $args['order'] = 'DESC'; // Or ASC
        $args['orderby'] = 'post_title'; // Or anything else
        return $args;
    }
    add_filter( 'woffice_wiki_query_args', 'my_woffice_wiki_sortby_title');
  •  626
    François replied

    Hello, 

    Sorry about that, there are several filters. 

    Just re-looked over it, can you try: 

    add_filter( 'woffice_wiki_items_query_args', 'my_woffice_wiki_sortby_title');

    Instead of the old one and let me know if that makes any differencesmile.png 

    Have a nice day

    Kind Regards,

    François 

    Want feedback on your awesome site? Get yourself a beta access on our new product Feedier.com here: https://feedier.com/