Viewing 2 posts - 1 through 2 (of 2 total)
    • Author
      Posts
    • winday
      Guest

      I’m building a site for a client where there are two specific blog categories that should not have the sharing buttons. How can I hide them by category?

      Hello,

      Currently, there is no inbuilt option to do that. You need to add some code to your theme’s function.php file.

      Code:

      if( has_category( array( YOUR_CATEGORY_IDs_TO_EXCLUDE_SEPARATED_BY_COMMA ) ) ){

      $wpsr_content_op = new WPSR_Template_Output(‘content’);
      $wpsr_excerpt_op = new WPSR_Template_Output(‘excerpt’);

      remove_filter(‘the_content’, array($wpsr_content_op, ‘output’));
      remove_filter(‘the_excerpt’, array($wpsr_excerpt_op, ‘output’));

      }

      Please try it. Thanks

    Viewing 2 posts - 1 through 2 (of 2 total)
    • The topic ‘Hide by category’ is closed to new replies.

    Subscribe for updates

    Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter