• Resolved sigul77

    (@sigul77)


    HI,

    I’d like to use it only for articles in the category “stories”, is it possible to limit the plugin use to a single category?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    Sure, that should be totally doable. I experimented with this code and it seems to do what you want:

    
    add_filter( 'displayfeaturedimagegenesis_disable', 'prefix_featured_image_only_stories' );
    /**
     * Disable the featured image output if we are not on the stories archive
     * and not on a singular post in the stories category.
     *
     * @param $disable
     *
     * @return bool
     */
    function prefix_featured_image_only_stories( $disable ) {
    	if ( ! is_category( 'stories' ) && ! in_category( 'stories' ) ) {
    		$disable = true;
    	}
    
    	return $disable;
    }
    

    This filter disables the featured image output sitewide, unless a post is in the stories category, or unless you are on the stories category archive. It will override whatever you’ve set on the settings page for other content types (if you disable Posts on the Content Types tab, then that will take priority).

    You can add this code to your theme functions.php file or similar place–just please practice safe coding, back up your files, etc. etc. Hope this helps you get started–

    Thread Starter sigul77

    (@sigul77)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is it possible to use the plugin only for a specific category?’ is closed to new replies.