• szwp

    (@szwordpress)


    When browsing through the blogs (open a blog to read it and scroll to the end to get to the navigation links), the navigation links display the titles of the previous and next blogs. I am wondering if there is a way to display the labels Previous and Next on the navigation buttons instead of the posts titles neatly encapsulated in an entry-meta-bar.

    I am using the Travelify Theme (Child theme) and WordPress version 4.3.1

Viewing 1 replies (of 1 total)
  • Hi @szwp,

    Thank you for your question.

    You can try achieving this by adding the following code in the functions.php file of your child theme.

    function modify_travelify_next_previous_post_link(){
    
        remove_action( 'travelify_after_post_content', 'travelify_next_previous_post_link' );
        add_action( 'travelify_after_post_content', 'custom_travelify_next_previous_post_link', 10 );
    }
    add_action( 'init', 'modify_travelify_next_previous_post_link'  );
    
    /**
     * Shows the next or previous posts link with respective names.
     */
    function custom_travelify_next_previous_post_link() {
    	if ( is_single() ) {
    		?>
    			<ul class="default-wp-page clearfix">
    				<li class="previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . __( 'Previous', 'travelify' ) . '</span>' ); ?></li>
    				<li class="next"><?php next_post_link( '%link', '<span class="meta-nav">' . __( 'Next', 'travelify' ) . '</span>' ); ?></li>
    			</ul>
    		<?php
    
    	}
    }

    Best Regards,
    Movin

Viewing 1 replies (of 1 total)
  • The topic ‘Travelify Theme – Show Next and Previous vs blog titles’ is closed to new replies.