[Resolved] Conditional 'Read More' text changes

Home Forums Support Conditional 'Read More' text changes

  • This topic has 2 replies, 2 voices, and was last updated 12 months ago by Greg.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #1249687

    Hi all

    Does anyone know of a way to add a function to change the ‘Read More’ text link based on a conditional such as a post tag? So for example for all posts tagged with ‘Photos’ the read more button text could be changed to ‘View Photos’, etc.

    I’ve found a couple of functions online but they seem to be theme specific.

    Thanks for any help

    Lead Developer
    Lead Developer

    Hi Greg,

    Not 100% sure it will work, but you could try this:

    add_filter( 'option_generate_blog_settings', function( $settings ) {
        if ( has_tag( 'photos' ) ) {
            $settings['read_more'] = 'View Photos';
        return $settings;
    } );

    Thanks for this Tom, just realised I’ve asked in the wrong forum as I’m using WP Show Posts to load my posts into the page in question, so I’ll repost over there!


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