Simple Facebook Connect
exclude pages? (8 posts)

  1. swiftini
    Posted 3 years ago #

    Hi Otto,

    Is it possible to automatically add a like button bu exclude certain pages (i.e. the contact us page)?

    I tried hacking your plugin using is_page() but I cannot seem to get it to parse correctly. Is there a filter and/or function somewhere that needs to be enclosed in an if statement?

    Any suggestions would be greatly appreciated

    Thanks in advance.


  2. swiftini
    Posted 3 years ago #

    To answer my own question, I guess one possible solution is to use the manual setting and place the function that calls the buttons inside the post/page templates. This requires the use of multiple templates, which is ok, I guess.

    Another solution would be to use a plugin like widget logic and place the buttons in widget areas, however, in my case I would have to create a new widget are.

    I suppose the hack I was trying to use didn't work because the filter acts on content, which is inside the loop, so it isn't possible to use a conditional is_page statement to limit this, however I am still wondering if there is some way to exclude certain pages in the code itself, without having to create new widget areas or potentially, new page templates.

    If the above is indeed possible, I have a feature suggestion:

    add a dropdown to the GUI that excludes certain pages or page types (templates). Also potentially post types.

    This may be a real pain, but I'm just spitballing here. I am curious to know what your thoughts are here.

    Love th plugin by the way.



  3. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 3 years ago #

    At the top of your page template where you want to exclude the like button, put this line of code:

    remove_filter('the_content', 'sfc_like_button_automatic', 30);

    Alternatively, put that in your theme's header.php or functions.php inside of an is_page based conditional.

  4. swiftini
    Posted 3 years ago #

    Thanks Otto

    I guess if it is set to manual I could also wrap the call to the function in an !is_page based conditional- am I right?

  5. safesoundaudio
    Posted 3 years ago #

    Hi Otto

    I need to contact you about some advice you gave a while ago concerning putting a conditional statement around the comments_template so the the comments box will only appear on the last page of a multi-page post. Is there a facility to send you a private message in wordpress?


  6. esmi
    Forum Moderator
    Posted 3 years ago #

    @safesoundaudio: It is impolite to interrupt another poster's thread with a question of your own. Also these forums do not have any PM system. Any support given here happens here.

  7. safesoundaudio
    Posted 3 years ago #

    I'm so sorry to interrupt your thread. My apologies.

  8. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 3 years ago #

    @swiftini: If it's set to manual, then it won't automatically include the like button at all. You'd have to use something in the theme to make the like button display in that case.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic