Support » Theme: OceanWP » Change The Continue Reading Text

  • Resolved marv2

    (@marv2)


    I would like to change the Continue Reading Text based on the custom post type.

    I tried using your code here and adapting it to my needs, but it is not working.

    Here is what I tried in my child functions.php:

    function myprefix_post_readmore_link_text() {
        if ( $post->post_type == 'paint' ) {
            $text = 'View Paints';}
        return $text;}
    add_filter( 'ocean_post_readmore_link_text', 'myprefix_post_readmore_link_text' );

    Any help is appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello marv2,

    Add below php code into your current active child theme’s functions.php file or you can use Code Snippets plugin for use below php code.

    
    add_filter( 'ocean_post_readmore_link_text', 'change_read_more_text' );
    
    function change_read_more_text() {
      return __( 'Read More', 'oceanwp' );
    }

    Hope this will helps you.

    Thanks.

    Theme Author oceanwp

    (@oceanwp)

    Hello, do you need to change the text only for your paint post type or all your site?
    If it is for your entire site, the code from @saurabhdhariwal will work.

    Thanks for your replies. I would like to change it just for the “paint” post type.

    Can you please try the code below:

    function myprefix_post_readmore_link_text($text) {
        if ( 'paint' == get_post_type() ) {
            $text = 'View Paints';
        }
        return $text;
    }
    add_filter( 'ocean_post_readmore_link_text', 'myprefix_post_readmore_link_text' );

    @rajeebthegreat Worked perfectly! Thanks!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change The Continue Reading Text’ is closed to new replies.