Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6631

    hi.

    i’m wondering if there’s a way to add ‘next’ and ‘prev’ arrows or buttons in individual blog posts

    so that people don’t have to return to the main blog page and then scroll down to read the next blog post.

    thanks!

    site: mothdrawn.com

    #54895

    Hey,

    in your includes folder find loop-index.php, now find:

    the_content(__('Read more →','avia_framework')); ?>

    After this line you can paste this:

    <?php previous_post_link('%link', 'Older Post', TRUE); ?>

    This will link to older posts, a link to newer posts will be generated by this:

    <?php next_post_link('%link', 'Newer Post', TRUE); ?>

    #54896

    thanks! :)

    #54897

    Glad that I could help you :)

    #54898

    Hi again. I did what you said and put the code in the loop-index. It shows on the individual blog posts, but it ALSO shows on the main blog page, which is cluttered and unnecessary. How do I get ‘next’ and ‘prev’ to show only on the individual blog posts?

    thanks!

    mothdrawn.com

    #54899

    Hey,

    use following code instead:

    <?php if is_single(){ ?>
    <?php previous_post_link('%link', 'Older Post', TRUE); ?>
    <?php next_post_link('%link', 'Newer Post', TRUE); ?>
    <?php } ?>

    #54900

    hi. i wish i could say that worked, but it made my whole blog turn into a blank page. when i took out the first and last lines of that code, it worked like before, so i guess there’s something amiss with the <?php if is_single(){ ?> perhaps?

    thanks for helping me with this!

    courtney

    mothdrawn.com

    #54901

    Hey,

    there was a tiny mistake in Dude’s if statement,

    replace the code with this:

    <?php if ( is_single() ) {
    previous_post_link('%link', 'Older Post', TRUE);
    echo "&nbsp;-&nbsp;";
    next_post_link('%link', 'Newer Post', TRUE);
    } ?>

    Let us know if it works :)

    #54902

    perfect! thank you so much!!

    #54903

    Glad that I could help you :)

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘'next' and 'prev' arrows/buttons in individual blog posts’ is closed to new replies.