How do I add Previous/Next Post on Blog Posts in Icon Stack?

Hi there. I can’ seem to find out how to activate the previous and next post on Icon stack. Thank you.

Hello,

Thank you for writing in!

To do it, you need to use the child theme to avoid further problems with your code, so, check this article to learn how to use it -> https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57 - if you`re using the child theme, please, ignore this message.

Now, you need to add the following custom code below at functions.php

function add_entry_navigation(){
  if( is_single() || x_is_portfolio_item() ) {
    the_post_navigation( array(
        'next_text' => '' . 'Next' . ' ' .
          '' . 'Next post:' . ' ' .
          '%title',
        'prev_text' => '' . 'Previous' . ' ' .
          '' . 'Previous post:' . ' ' .
          '%title',
      ) );
  }
}
add_action('x_before_view_global__comments-template', 'add_entry_navigation' );

Remember that is important to clear your cache after it.

Thanks!

Hi, John. Thank you. I"m using childtheme that there is a function with Jetpack which puts 3 related posts in the bottom below the article. It still does not allow for previous and next posts. But I’ll stick with that for now. If you do know how to add the previous next post in css coding under customization, then let me know. Thank you.

Hi there,

Unfortunately, it is not possible to add such a thing with CSS code. YOu need to use PHP code which my colleague gave you the instruction for.

Thank you.

Would this same code apply to the Integrity stack? There is navigation at the top of the posts but i would like to also display it at the bottom of each post. Also is there a recommended plugin for this? I haven’t been able to find one. Thanks.

Hello @tburroug87,

The same code can be used for Integrity stack. Unfortunately we can’t recommend you plugin for the feature you looking for.

Thanks for understanding.

Hello, I was doing some editing to function file and the site blew up. I restarted with original child theme function file. Trying to add this code back and keep getting: Parse error: syntax error, unexpected ‘}’, expecting end of file in /home1/handhblo/public_html/wp-content/themes/x-child/functions.php on line 28. Not sure what could be causing this as i used this code previously. I tried making sure i don’t have any extra }, nothing is working. any ideas?

Hi There,

That error means you’ve mostly closed a code block too early. Please make sure that {} are partnered correctly. You may share the content of your functions.php so we can check.

Hi there,

It’s because of this line

//function add_entry_navigation(){

It should be like this,

function add_entry_navigation(){

Thanks!

thanks so much! such an easy fix!

You’re most welcome!