Post next Categories arrows

I am using the Ethos template, and when you go to a post category page, there is a forward and backwards arrow to go to next and previous post.

Is there a way to make this only work with the category?

As at the moment it just goes to the next post I had published only in different categories.

Cheers

Hi Jonathan,

It should go the next post inside a category by default. Check this thread please to check the current function use on the feature. Hope this helps.

Hi Lely,

Yes I found that post but they said the same it should be set to default.

But if I am on a category such as Trading Lessons on my site, the next post goes to another category such as Trade setups so it isn’t set like you say as default.

If you go to this page- https://www.norfolkfxtrader.com/forex-trading-strategy-that-works/

This is the Trading lessons category, but the next post goes to the Trade Setups Category not the next post within Trading lessons

Hello Jonathan,

Can you share wordpress credentials inside a secure note so we can check the setup? Thank you.

Are there any settings within the theme to make changes to this or are they all already pre fixed within the theme?

As I don’t think it will make much difference you looking into my WordPress if the issue lies with your theme, unless of course you can tell me if there are settings that can be changed.

I have not experienced this issue before with previous themes so from that Info I would assume its to due with the theme it’self

Hi Jonathan,

It’s prefixed by Wordpress and the theme only uses the function provided by it. Hence, the only solution is customizing the code, plus, it’s Wordpress that decide which data is to serve to the theme and the theme only displays it. For example, that code displays the prev/next link according to Wordpress with the default setting, then the theme only styled it and positioned to match the design.

And which is why we need to check what’s going on first by logging in, as I myself can’t confirm what categories they really belong just by looking at your provided post. There could be multiple categories assigned to it or some filter from 3rd party code or plugins.

Let us know once you provide the credentials and we’ll do further checking.

Thanks!

I have added the credentials for you login to WordPress and check thanks

Hi Jonathan,

It appears you haven’t implemented the custom code as of yet, the default category will only work if the first option is set to true. Please add this code to your child theme’s functions.php as a workaround,

  function x_entry_navigation() {

  $stack = x_get_stack();

  if ( $stack == 'ethos' ) {
    $left_icon  = '<i class="x-icon-chevron-left" data-x-icon-s="&#xf053;"></i>';
    $right_icon = '<i class="x-icon-chevron-right" data-x-icon-s="&#xf054;"></i>';
  } else {
    $left_icon  = '<i class="x-icon-arrow-left" data-x-icon-s="&#xf060;"></i>';
    $right_icon = '<i class="x-icon-arrow-right" data-x-icon-s="&#xf061;"></i>';
  }

  $is_ltr    = ! is_rtl();
  $prev_post = get_adjacent_post( true, '', false );
  $next_post = get_adjacent_post( true, '', true );
  $prev_icon = ( $is_ltr ) ? $left_icon : $right_icon;
  $next_icon = ( $is_ltr ) ? $right_icon : $left_icon;

  ?>

  <div class="x-nav-articles">

    <?php if ( $prev_post ) : ?>
      <a href="<?php echo get_permalink( $prev_post ); ?>" title="<?php __( 'Previous Post', '__x__' ); ?>" class="prev">
        <?php echo $prev_icon; ?>
      </a>
    <?php endif; ?>

    <?php if ( $next_post ) : ?>
      <a href="<?php echo get_permalink( $next_post ); ?>" title="<?php __( 'Next Post', '__x__' ); ?>" class="next">
        <?php echo $next_icon; ?>
      </a>
    <?php endif; ?>

  </div>

  <?php

  }

Then it should only revolve on the same taxonomy term, in which by default will be the category taxonomy.

Hope this helps.

Hi,

thanks for looking, when you say custom code are you referring to the use of a child theme?

Hello Jonathan,

Thanks for updating the thread.

Yes, it’s always advisable to make the changes via child theme. To learn more, please refer following post:

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.