ChrisHardie / printable-pdf-newspaper

WordPress plugin to generate a printable PDF newspaper from post content
GNU General Public License v2.0
7 stars 1 forks source link

Feature: Post Sort #33

Closed Luckycooper closed 3 years ago

Luckycooper commented 3 years ago

Hi

It would be great if you could sort the pages and posts.

Example: In a travelogue, it doesn't make sense if the latest post comes first. You want to start the journey all over again.

But otherwise cool plugin, greetings Lukas

ChrisHardie commented 3 years ago

Hi @Luckycooper - I'm glad you like the plugin.

You can use the ppn_post_query_args filter to change how the post query works, including changing the order. Here's an example of what it might look like added to your functions.php file (not tested) to sort by post date ascending:

add_filter( 'ppn_post_query_args', function( $query_args ) { $query_args['orderby'] = 'date'; $query_args['order'] = 'ASC'; return $query_args; }, 10, 1 );

I hope that helps.