Change Archive List Order Ascending or Descending

QuestionsCategory: PDF Light ViewerChange Archive List Order Ascending or Descending
Mark asked 9 years ago
On the archive page, I would like to list the most recent files first, and the oldest at the bottom/end. Is there a way to specify this? Thank you for your time and help.
Also, is there a way to do a bulk import of many PDF files without using WP-CLI? Thanks.

Subject: Support request, plugin: pdf-light-viewer (time: 15.06.2016 20:58:23)

Server Info

  • os -> Linux host137.hostmonster.com 3.12.52-20160119.106.ELK6.x86_64 #1 SMP Tue Jan 19 16:53:32 CST 2016 x86_64
  • php -> 5.6.17
  • mysql -> 5.5.42-37.1-log
  • wordpress -> 4.5.2

Theme
Bethlehem, 1.2.1, http://demo.transvelo.in/wp/bethlehem/
from Transvelo, http://transvelo.com

Plugins

1 Answers
support answered 8 years ago
Hello Mark,

Is there a way to specify this?

For now archive page should already work as you need it. Default order is descending on field post_date. However if you need to change it somehow you could use the following code snippet in your theme’s functions.php:

function pdf_lv_archive_change_orderby( $orderby ) { 
    if (is_post_type_archive(array(PdfLightViewer_PdfController::$type))) {
        return 'post_date ASC';
    }
    else {
        return $orderby;
    }
}
add_filter( 'posts_orderby', 'pdf_lv_archive_change_orderby' );

 

Also, is there a way to do a bulk import of many PDF files without using WP-CLI?

Unfortunately, CLI is the only possibility for now.