• This topic has 2 replies, 2 voices, and was last updated 9 years ago by Lars.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #81033
    Lars
    Participant

    Hi

    I need to edit the navigation text (“older posts”/”Newer posts”) on the search result page and would really appreciate some guidance on how this may be accommodated.

    #81038
    Pratik
    Participant

    Hi @Lars,

    If you want to change that navigation text, you will need to do a bit of customization using a Child theme. Please follow following steps:
    1. Create A Child Theme for Catch Flames Pro. Details for child theme is here
    2. Then you need to add following codes in your Child Theme’s functions.php file:

    
    /**
     * Display navigation to next/previous pages when applicable
     */
    function catchflames_content_nav( $nav_id ) {
    	global $wp_query;
    
    	/**
    	 * Check Jetpack Infinite Scroll
    	 * if it's active then disable pagination
    	 */
    	if ( class_exists( 'Jetpack', false ) ) {
    		$jetpack_active_modules = get_option('jetpack_active_modules');
    		if ( $jetpack_active_modules && in_array( 'infinite-scroll', $jetpack_active_modules ) ) {
    			return false;
    		}
    	}
    
    	$nav_class = 'site-navigation paging-navigation';
    	if ( is_single() )
    		$nav_class = 'site-navigation post-navigation';
    
    	if ( $wp_query->max_num_pages > 1 ) { ?>
            <nav role="navigation" id="<?php echo $nav_id; ?>">
            	<h3 class="assistive-text"><?php _e( 'Post navigation', 'catch-flames' ); ?></h3>
    			<?php if ( function_exists('wp_pagenavi' ) )  {
                    wp_pagenavi();
                }
                elseif ( function_exists('wp_page_numbers' ) ) {
                    wp_page_numbers();
                }
                elseif ( is_search() ) { 
                	//Change Text only for search pages
                	?>
                    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> NEW Older posts TEXT', 'catch-flames' ) ); ?></div>
                    <div class="nav-next"><?php previous_posts_link( __( 'NEW Newer posts TEXT<span class="meta-nav">&rarr;</span>', 'catch-flames' ) ); ?></div>
                <?php
                }
                else { ?>
                    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'catch-flames' ) ); ?></div>
                    <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'catch-flames' ) ); ?></div>
                <?php
                } ?>
            </nav><!-- #nav -->
    	<?php
    	}
    }
    

    Please note the NEW Older posts TEXT and NEW Newer posts TEXT. You can change this text to desired text for your search page.

    #81042
    Lars
    Participant

    Hi Pratik
    Excellent, it works very well. Thank you very much for a swift answer to my request.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Edit search result page navigation text’ is closed to new replies.