Simon Macson
asked 10 years ago

Hello,

I would like the ‘Read Next’ link at the bottom of posts to show the more recent post chronologically (rather than going back historically). Is there a way to do this?

For clarity, I have a website that runs like a book with a new chapter released every week. If a visitor is on chapter 5, I would like the Read Next panel to take them to the more recent chapter 6 (rather than chapter 4).

Many thanks in advance,

Simon

3 Answers
DominicStaff
answered 10 years ago

Hi,
To resolve this issue, you can open the wp-content\themes\dw-timeline\templates\content-single.php file. Add the following code under line 10.

<div class="post-naviagtion">
    <span class="prev-post">
    <?php previous_post_link(); ?> 
    </span>
    <span class="next-post">
     <?php next_post_link(); ?> 
    </span>
    </div>

Then add the following code to the style.css file:

.single-post .post-naviagtion {
    display: inline-block;
    width: 100%;
}
.single-post .prev-post {
    float: left;
    width: 50%;
}
.single-post .next-post {
    float: right;
    width: 50%;
}
.post-naviagtion a {
    color: #21759b;
}
.post-naviagtion span {
    font-size: 24px;
    color: #21759b;
}

Note: All the posts within Same Category.
Hope this helps !

Simon Macson
answered 10 years ago

Many thanks for swift response, though perhaps I was not clear enough…

I actually want the whole footer panel with featured image to show the next post, not the previous.

Simon

DominicStaff
answered 10 years ago

You can add the following code under line 10 of the content-single.php file:

<div id="cooler-nav" class="navigation">
                <?php $prevPost = get_previous_post(true);
          if($prevPost) {?>
          <div class="nav-box previous" style="float:left;">
                    <?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(60,60) );}?>
                    <?php previous_post_link('%link',"$prevthumbnail  %title", TRUE); ?>
          </div>

                <?php $nextPost = get_next_post(true);
          if($nextPost) { ?>
                <div class="nav-box next" style="float:right;">
          <?php $nextthumbnail = get_the_post_thumbnail($nextPost->ID, array(60,60) ); } ?>
          <?php next_post_link('%link',"$nextthumbnail  %title", TRUE); ?>
                    </div>
                </div><!--#cooler-nav div -->

Then add the following code to the style.css file:

.single-post .navigation { display: inline-block; width: 100%; }
#cooler-nav{clear: both; height: 100px;}
#cooler-nav .nav-box{background: #e9e9e9; padding: 10px;}
#cooler-nav img{float: left; margin: 0 10px 0 0;}
#cooler-nav .previous{float: left; vertical-align: middle; width: 250px;}
#cooler-nav .next{float: right; width: 250px;}

Note: If you don’t want to use the previous post, you can add the following code:
#cooler-nav .previous { display: none; }

Hope this helps !

simonmacson
replied 10 years ago

Hi Dominic,

That still doesn’t help I’m afraid. I don’t want to add links or images, I simply want to replace the footer ‘Read Next’ panel to display the next post chronologically, not the previous.

Below is a screenshot if that is still not clear:
http://timeline.childrenofgraffiti.com/wp-content/uploads/2015/08/Screen-Shot-2015-08-18-at-07.59.45.png

The selected post is Chapter 3, and I want the read next panel to display Chapter 4, NOT the previous Chapter 2.

I hope that is clearer and you can provide a helpful resolution.

Simon

dominic Staff
replied 10 years ago

To resolve this issue, you can open the \wp-content\themes\dw-timeline-pro\lib\custom.php file. Find the line 38.
Replace the following code:
$adjacent_post = get_adjacent_post(false,$adjacent_post_exclude);

With new code:
$adjacent_post = get_adjacent_post(false,$adjacent_post_exclude, $next);

Hope this helps !

simonmacson
replied 10 years ago

Perfect – thank you very much for your help!

Powered by DW Question & Answer Pro