WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
[resolved] disabling filters for individual pages / posts (2 posts)

  1. gekido
    Member
    Posted 3 years ago #

    Hello,

    Love the plugin, working great - except that it is showing the 'like' buttons on all of my static pages as well as content posts.

    I'm about to dive into the code for the plugin to try and figure out which filters I need to disable for the page displays (I have a bunch of pages that include each other to display a main page and end up with 15 like buttons all over the place ;P ), but it would be nice to be able to disable the like buttons etc on pages and/or posts (or even individual pages / posts ideally)...

    Thanx again!

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 3 years ago #

    Put something like this into your theme's functions.php file.

    remove_filter('the_content', 'sfc_like_button_automatic', 30);
    add_filter('the_content', 'sfc_like_button_semi_automatic', 30);
    
    function sfc_like_button_semi_automatic($content) {
     global $post;
     // use any rules you like here.. this one disables it on pages
     if ($post->post_type != 'page') {
      $content = sfc_like_button_automatic($content);
     }
     return $content;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic