A
A
Alexander2018-02-20 23:28:50
WordPress
Alexander, 2018-02-20 23:28:50

How to display records with the ability to sort for the user?

Good afternoon, evening.
I'm looking for help in the task, maybe someone will tell you where to look or what plugin to use.
The site will have several sections with entries.
(Plays, scripts, articles)
I need to display entries from the selected category on the page. But not just display, but make it possible to sort for visitors by creation date or alphabetically (post name) with pagination.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ainur Valiev, 2018-02-21
@vaajnur

$args = array( 'posts_per_page' => -1, 'orderby'=> 'title', 'order' => 'ASC' ); 
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) : 
   while ( $my_query->have_posts() ) : $my_query->the_post(); 
      // do stuff here
   endwhile; 
endif;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question