WordPress.org

Ready to get started?Download WordPress

Forums

Pagination for Posts on Custom Page Template (2 posts)

  1. Havenjay
    Member
    Posted 1 year ago #

    I have successfully managed to direct posts from particular categories to specific pages. However, I intend to write long excerpts in these posts, and I would like to be able to split them up, preferably through pagination. I have read that it's not possible to do on Pages, but many of those posts are dated 6+ years ago.

    Ideally, I would like to be able to have multiple posts from multiple categories on one page (which I already have), with each post being able to be split up into multiple pages. One, is this possible? Two, how can I rewrite my code to do it?

    Here is my current code for the custom page template:
    http://wordpress.pastebin.ca/2175557

    I am not a very savvy coder, so I am sure there is a better way to write what I have. I'm assuming I am not writing the code properly, or have something in my current code that is stopping me from effectively using pagination. (I would prefer not to use a plugin, if possible.)

    Does anyone have any fixes that might work for me?

  2. vtxyzzy
    Member
    Posted 1 year ago #

    It is fairly easy to show just an excerpt of each Post with a 'Read More' link to bring up the entire content.

    First, change this:

    <?php
    query_posts('cat=3,4,5');
    ?>

    to this:

    <?php
    function new_excerpt_more($more) {
           global $post;
    	return '<a href="'. get_permalink($post->ID) . '">Read the Rest...</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    query_posts('cat=3,4,5');
    ?>

    and replace this:

    <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>

    with this:

    <?php the_excerpt(); ?>

    Breaking each Post up into individual pages will require editing each post to insert the breaks and possibly modifying the single.php template.

Topic Closed

This topic has been closed to new replies.

About this Topic