Avada Forums Community Forum How to change useless Avada’s post navigation to more useful?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • pasha4ur
    Participant
    Post count: 18

    Hello

    On post page Avada’s developers shows 100% useless post navigation:

    Previous Next

    Free template (Sparkling) on my existing site shows post names. How to change this in Avada? I found this function in free template here:

    https://github.com/mattyribbo/Sparkling-PGKO/blob/master/inc/template-tags.php

    I don’t know where is this function in files of free template on my site. Can’t find it in functions.php

    function sparkling_post_nav() {	
    	// Don't print empty markup if there's nowhere to navigate.
    	$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
    	$next = get_adjacent_post( false, '', false );
    	if ( ! $next && ! $previous ) {
    	return;
    	}
    	?>
    	<nav class="navigation post-navigation" role="navigation">
    	<h1 class="screen-reader-text"><?php esc_html_e( 'Post navigation', 'sparkling' ); ?></h1>
    	<div class="nav-links">
    	<?php
    	previous_post_link( '<div class="nav-previous">%link</div>', _x( '<i class="fa fa-chevron-left"></i> %title', 'Previous post link', 'sparkling' ) );
    	next_post_link( '<div class="nav-next">%link</div>', _x( '%title <i class="fa fa-chevron-right"></i>', 'Next post link', 'sparkling' ) );
    	?>
    	</div><!-- .nav-links -->
    	</nav><!-- .navigation -->
    	<?php
    	}
    	endif;

    I don’t know what means arguments like ‘sparkling’.

    Ammar. S
    Keymaster
    Post count: 2253

    Hello @Pasha4ur

    Every theme has its own design, what you see there is Avada’s design decision when it comes to navigation, we do not show post names on single post navigation but Previous / Next only.

    Thanks

    -Ammar

    pasha4ur
    Participant
    Post count: 18

    Hello

    You answer doesn’t help any kind.

    You could help with solution of problem and don’t be Captain Obvious. )

    pasha4ur
    Participant
    Post count: 18

    Looks like this works correct

    if ( ! function_exists( 'pasha4ur_post_nav' ) ) :
    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    	function pasha4ur_post_nav() {
    		// Don't print empty markup if there's nowhere to navigate.
    		$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
    		$next     = get_adjacent_post( false, '', false );
    
    		if ( ! $next && ! $previous ) {
    			return;
    		}
    		?>
    		<nav class="navigation post-navigation" role="navigation">
    			<h1 class="screen-reader-text"><?php esc_html_e( 'Post navigation', 'default' ); ?></h1>
    			<div class="nav-links">
    				<?php
    					previous_post_link('<span class="nav-previous">%link</span>', _x('%title', 'Previous post link'), true, '', 'category');
    					next_post_link('<span class="nav-next">%link</span>', _x('%title', 'Next post link'), true, '', 'category');
    				?>
    			</div><!-- .nav-links -->
    		</nav><!-- .navigation -->
    		<?php
    	}
    endif;
    marklchaves
    Participant
    Post count: 873

    This will work too. Replace the pagination in your child theme’s single.php with this.

    
    <?php 
      $previous = get_previous_post();
      $next = get_next_post(); ?>
    <?php 
      if ( $previous ) { ?>
        <?php 
          previous_post_link( '%link', esc_attr__( get_the_title( $previous ), 'Avada' )); ?>
      <?php } ?>
    <?php 
      if ( $next ) { ?>
    	<?php 
    	  next_post_link( '%link', esc_attr__( get_the_title( $next ), 'Avada' )); ?>
      <?php } ?>
    
    Ammar. S
    Keymaster
    Post count: 2253

    Hello @Marklchaves

    Thanks for helping the fellow community member 🙂

    Hello @Pasha4ur

    Glad to hear that you have found a workaround. We also have an item opened on this particular request and our developers will be looking to add an option in future if possible!

    Thanks

    -Ammar

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.