• Resolved Herve Kabla

    (@hkabla)


    Hi

    I’d like to change the ‘next post’ and ‘previous post’ link labels that appear at the bottom of the page of a pod. I’d like to replace the term ‘post’ by the name of the pod. Unfortunately, I cannot find how I can achieve this.

    Can you help me ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Paul Clark

    (@pdclark)

    This is typically set in the theme, but can usually be filtered with the gettext translation filter.

    For example, to change the text of “post” as in “Previous post” and “Next post” in the Twenty Twenty One theme, one could use this:

    <?php
    
    add_filter(
    	'gettext',
    	function( $translation, $text, $domain ) {
    		if ( 'custom_post_type' === get_post_type() && ! is_admin() ) {
    			$find_replace = [
    				'post' => 'Custom Post Type Label',
    			];
    			return str_replace( array_keys( $find_replace ), array_values( $find_replace ), $translation );
    		}
    		return $translation;
    	},
    	10,
    	3
    );

    Where the post type is custom_post_type and the label is Custom Post Type Label.

    Thread Starter Herve Kabla

    (@hkabla)

    Thanks for your answer, but in that case, that would change the label for all posts.

    What I would like to achieve, is have it changed to ‘previous <pod name>’ and ‘next <pod name>’ according to the pod name.

    I guess the template is not the best way to do it, no ?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @hkabla

    Please search in your theme for reference to that post navigation.
    It will probably be this function:

    https://developer.www.ads-software.com/reference/functions/get_the_post_navigation/

    In any case this is theme area, not Pods ??

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change ‘next post’ and ‘previous post’ link label’ is closed to new replies.