Support » Plugin: Reading Time WP » Suppress on selected posts

  • Resolved robnz

    (@robnz)


    Hi
    I love this plugin and have it set to display on posts.
    I would like to suppress it on selected posts or at least suppress by the literal post format type – eg “Aside” as compared to “Stanard”

    It seems that the only way is to remove global setting and add it each post individually except the ones I don’t wish to include.

    Is there any easier way?
    thank you
    Rob

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jason Yingling

    (@yingling017)

    Hi there,

    I had a similar request to this previously. Here’s a code snippet that allows you to remove the reading time from certain Posts based on their Post ID.

    add_action( 'the_post', 'remove_reading_time_by_id' );
    function remove_reading_time_by_id( $post_object ) {
    	$post_ids = array(
    		'53',
    		'10',
    	);
    	global $reading_time_wp;
    	if ( in_array( $post_object->ID, $post_ids ) ) {
    		remove_filter( 'the_content', array( $reading_time_wp, 'rt_add_reading_time_before_content') );
    	} else {
    		add_filter( 'the_content', array( $reading_time_wp, 'rt_add_reading_time_before_content') );
    	}
    }
    lucasrodriguezest1994

    (@lucasrodriguezest1994)

    @yingling017

    Hello Jason,

    I enjoy the simplicity and design of your plugin, it works really well. I was looking for a solution similar to the one above, I just need the reading time to NOT display on a certain Blog category. Is there a way to exclude a category so that the reading time will show on all other posts except the chosen category. This would save me having to teach the client about using shortcodes and have him use it every time he wants to post. Any help is appreciated.

    Thank you,

    Lucas Rodriguez

    Plugin Author Jason Yingling

    (@yingling017)

    Hi Lucas,

    You could modify the function above to check which category the current post is remove the filter if it’s a certain category.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Suppress on selected posts’ is closed to new replies.