Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #895107
    CrikeyMate
    Participant

    Hello!

    Two things, really.

    First of all, as the thread title says; Buttons. The forward and next buttons, as on Ethos posts. How do I also display these buttons on Mobile devices.

    Secondly, how do I get those said buttons (On desktop and mobile) to display ONLY posts from with the current Posts category. I read and used another posts’ solution on here (from 2014), but the little arrow indicator inside the button disappeared when I did.

    Actually, ONE more thing whilst I am here;

    I am having random 400 errors on some images. This is not an X problem, per se, but I am hoping you can assist me, because everything I’ve tried has failed. My question is;

    How can I use a random/default image to replace the 400 erroneous images? For example, if a certain post gets a 400 error, instead of displaying the little icon that shows “error”, can I instead show a default image? If so, pleassssse tell me.

    Thanks all for now. 🙂

    #895108
    CrikeyMate
    Participant
    This reply has been marked as private.
    #896140
    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    Not sure if it’s really possible as I never tried it before, but according to this https://codex.wordpress.org/Function_Reference/previous_post_link
    https://codex.wordpress.org/Function_Reference/get_adjacent_post

    in_same_term
    (boolean) (optional) Indicates whether previous post must be within the same taxonomy term as the current post. If set to ‘true’, only posts from the current taxonomy term will be displayed. If the post is in both the parent and subcategory, or more than one term, the previous post link will lead to the previous post in any of those terms.

    It’s WordPress’s feature, and not something added by the theme. But we do only integrated it into the design.

    Let’s try this, please add this code to your child theme’s functions.php

    function x_entry_navigation() {
    
      $stack = x_get_stack();
    
      if ( $stack == 'ethos' ) {
        $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
    
      }

    Then please add this CSS to Admin > Appearance > Customizer > Custom > Gobal CSS as well

    @media (max-width: 767px){
    .single-post .x-nav-articles {
        display: block;
        float: none;
        margin: 0px auto 20px;
        clear: both;
        width: 82px;
    }
    }

    And I’m not getting any 400 Bad Requests on my end. Would you mind providing the exact URL?

    Thanks!

    #896562
    CrikeyMate
    Participant

    Worked like a charm. You’re a legend, Rad.

    One other thing; Can the Next & Previous buttons show a “random” post from said category? As opposed to simply via Date.

    As for the 400 error. It’s quite random, and I deleted the posts it was affecting. Though, it’ll happen again in the future I am sure. Is there a “generic” code I could use in the event it happens again?

    #897730
    Rad
    Moderator

    Hi there,

    There is no code and it’s more related your hosting’s setting or limitation. For example, it has a limit for the connection’s it can serve a session. It’s best to contact your hosting provider it this issue comes` again.

    Thanks!

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