Help with query_posts, pagination and Read More
-
Hi, I am trying out using query_posts, but pagination and Read More somehow does not work properly.
For pagination, I know that I can add the necessary template tags for the Previous Entries and Next Entries link, but I can’t seem to get the page numbers to work.
The page numbers code (in content.php) is as follows:
wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', 'separator' => '<span class="screen-reader-text">, </span>', ) );
In addition, Read More typically shows on my pages as ‘Continue Reading ->’, but when I use query_posts, it shows ‘(more…) ->’ instead. Why is this so?
Here’s my query_posts code:
<?php /* Template Name: My Custom Page */ /** * The template for displaying pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other "pages" on your WordPress site will use a different template. * * @package WordPress * @subpackage Twenty_Fifteen * @since Twenty Fifteen 1.0 */ get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php query_posts( array( 'category__and' => array(23), 'posts_per_page' => 5, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ) ) ); /* translators: %s: Name of current post */ // Start the loop. while ( have_posts() ) : the_post(); // Include the page content template. get_template_part( 'content', 'page' ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : comments_template(); endif; // End the loop. endwhile; ?> </main><!-- .site-main --> </div><!-- .content-area --> <?php get_footer(); ?>
And the page where it is on is here: https://www.buyfromwhere.com/test
Any help would be greatly appreciated!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Help with query_posts, pagination and Read More’ is closed to new replies.