Supporto » Sviluppare con WordPress » Ordinamento Archivio

  • Salve a tutti,
    avrei bisogno di un aiuto per ordinare gli archivi dei post e dei custom post type.

    La funzione che ho trovato è la seguente:
    //Ordinamento Archivi Codici
    add_action( ‘pre_get_posts’, ‘my_change_sort_order’);
    function my_change_sort_order($query){
    if(is_archive()):
    //If you wanted it for the archive of a custom post type use: is_post_type_archive( $post_type )
    //Set the order ASC or DESC
    $query->set( ‘order’, ‘ASC’ );
    //Set the orderby
    $query->set( ‘orderby’, ‘date’ );
    endif;
    };

    Il mio problema è che i post devono essere ordinati in ordine decrescente mentre i custom post type in ordine crescente.
    Qualcuno riesce ad aiutarmi?

  • Il topic ‘Ordinamento Archivio’ è chiuso a nuove risposte.