Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #995172
    rosstm
    Participant

    I am trying to change the functionality of the arrows so that they will only cycle through the current portfolio category rather than all portfolio posts. I have found the following code on other similar support threads, but when I try it, the arrows do not render at all.

    function x_entry_navigation() {
    
      $stack = x_get_stack();
    
      if ( $stack == 'integrity' ) {
        $left_icon  = '<i class="x-icon-chevron-left" data-x-icon=""></i>';
        $right_icon = '<i class="x-icon-chevron-right" data-x-icon=""></i>';
      } else {
        $left_icon  = '<i class="x-icon-arrow-left" data-x-icon=""></i>';
        $right_icon = '<i class="x-icon-arrow-right" data-x-icon=""></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
    
      }
    #995174
    rosstm
    Participant
    This reply has been marked as private.
    #995693
    Rupok
    Member

    Hi there,

    Can you enable WP_DEBUG mode? You can do this by opening wp-config.php and adding
    define( 'WP_DEBUG' , true ); just above /* That's all, stop editing! Happy blogging. */ For example:

    define('WP_DEBUG', true);
    
    /* That's all, stop editing! Happy blogging. */

    When you revisit the page with the white screen, you should have some error output describing the issue in more detail.

    #998314
    rosstm
    Participant

    I have done that. But I didn’t say anything about a white screen? The arrows do not appear everything else is fine.

    #998783
    Rad
    Moderator

    Hi there,

    Your stack is ethos while the code has the condition for integrity. Hence, it will not display. Try changing this line,

    if ( $stack == 'integrity' ) {

    to this,

    if ( $stack == 'ethos' ) {

    It was originally made for ethos, the one you copied could be custom code for integrity.

    Thanks!

    #1000881
    rosstm
    Participant

    No my stack is integrity. I have tried both just for fun. Doesn’t work.

    Any other ideas?

    #1000972
    Rad
    Moderator

    Hi there,

    In that case, you don’t need to add this custom code. Integrity has its own nav arrows along with the breadcrumbs. But, I just found out that it’s only applicable for the built-in post type and taxonomy.

    Some did it here http://stackoverflow.com/questions/10376891/make-get-adjacent-post-work-across-custom-post-types

    But that is just for post type’s query, custom taxonomy like portfolio category isn’t even included. Hence, it’s a long customization in which I can’t cover. You may hire a developer that could do it.

    This is not a theme limitation, but WordPress’s function limitation ( https://codex.wordpress.org/Function_Reference/get_adjacent_post )

    Thanks for understanding.

  • <script> jQuery(function($){ $("#no-reply-995172 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>