Limitless amount of posts in custom archive page
Don’t use query_posts(). Try: <?php $query = new WP_Query(‘orderby=title&order=ASC&posts_per_page=-1’); if ($query->have_posts()) : while ($query->have_posts()) : the_post(); ?>
Don’t use query_posts(). Try: <?php $query = new WP_Query(‘orderby=title&order=ASC&posts_per_page=-1’); if ($query->have_posts()) : while ($query->have_posts()) : the_post(); ?>
Ok, I found a solution that I can’t explain: I had to change Settings > Reading > Blog pages show at most = 1
Use this in your child themes functions.php file add_action( ‘pre_get_posts’, ‘exclude_category_posts’ ); function exclude_category_posts( $query ) { if( $query->is_main_query() && $query->is_home() ) { $query->set( ‘cat’, ‘-27,-30′ ); } } Add a comma separated list of category i.d’s to the set. Never Use Query Posts
Your query displays the first 9 posts regardless of page because you don’t set the page number in your query arguments. $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1; $args = array( ‘post_type’ => ‘issues’, ‘posts_per_page’ => ‘9’, ‘order’ => ‘ASC’, ‘paged’ => $paged );
Your construction of your custom loop is a bit of a mess unfortuantely. I’m not going to go through this now, but I’ll add links for you to go and read through :-). You should go and have a look on how to properly construct a custom query with WP_Query. You should also have a … Read more
use per the quoted Codex chapter for example: next_posts_link( ‘Older posts → ‘, $loop->max_num_pages ) and also: previous_posts_link( ‘← Newer posts’, $loop->max_num_pages )
Okay I got it.. Apparently there’s going to be some be issues if you name your page name the same as your custom post type. In this case my page was named ‘articles’ while my custom post type is also named ‘articles’ so that why I it didn’t work. I made a new page tested … Read more
The reasons why you should not run query_posts() are perfectly outlined in this answer. Long story short: You overwrite the default query (that happens by WP core) and replace everything that was valid for this request with data that only matches for your secondary query. The function get_query_var() relies on the global $wp_query that gets … Read more
You will need to modify (or create your own) the script that does the loading to change the URL once he loads a new page. Changing the URL may not be so simple, but you can have a look at this question for tips: https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page
That’s because you have to change your query also have add ‘paged’ => get_query_var( ‘paged’ ) So your new query should look like $args=array( ‘post_type’ => ‘post’, ‘paged’ => get_query_var( ‘paged’ ),// add this line ‘post_status’ => ‘publish’, ‘posts_per_page’ => 20 ); For for information have a look at the WP_QUERY Class