Wordpress MySQL Query for category pages -


I have been using this question to display posts on my WordPress index.fpp and sort them according to date I am (oldest first ASC). I use this database query because query_posts does not work for me for some reasons.

Now I want to use exact query on my class pages.

Do anyone have any solutions?

OK, depending on your information that you posted, you use something like this You can:

  $ args = array ('post_status' = & gt; array ('published', 'future'), 'post-type' = & gt; 'post' 'Orderbie' = & gt; 'date', 'order' = & gt; 'asc'); $ The_query = New WP_Query ($ Args); While ($ the_query-> is_pause ()): $ the_query-> The_post (); The_time ('L, FJS, Y'); material(); The_category (); Endwhile; Wp_reset_postdata ();   

Update with request
  get_header (); ? & Gt; & Lt; Section id = "primary" class = "site-content" & gt; & Lt; Div id = "content" role = "main" & gt; & Lt ;? Php if (have_posts ()):? & Gt; & Lt; Header class = "archive-header" & gt; & Lt; H1 class = "archive-title" & gt; & Lt ;? Php printf (__ ('Category archives:% s'), '& lt; span & gt;'. Single_cat_title ('', false). '& Lt; / span & gt;'); ? & Gt; & Lt; / H1> & Lt ;? Php if (category_description ()): // Show an optional category description? & Gt; & Lt; Div class = "archive-meta" & gt; & Lt ;? Php echo category_description (); ? & Gt; & Lt; / Div & gt; & Lt ;? Php endif; ? & Gt; & Lt; / Header & gt; & Lt ;! - Archae-Header - & gt; & Lt ;? Php $ args = array ('post_status' = & gt; array ('publish', 'future'), 'post_type' = & gt; 'post', 'orderbie' = & gt; 'date', 'order' = & Gt; ASC '); $ The_query = New WP_Query ($ Args); While ($ the_query-> is_pause ()): $ the_query-> The_post (); The_time ('L, FJS, Y'); material(); The_category (); Endwhile; Wp_reset_postdata (); ? & Gt; & Lt ;? Php else:? & Gt; & Lt ;? Php endif; ? & Gt; & Lt; / Div & gt; & Lt ;! - #content - & gt; & Lt; / Section & gt; & Lt ;! - #primary - & gt; & Lt ;? Php get_sidebar (); ? & Gt; & Lt ;? Php get_footer (); ? & Gt;   

This is a twentyWhile category page that displays:

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -