WordPress.org

Support

Support » Plugins and Hacks » Facebook » [Resolved] How to show Comments only on certain pages?

[Resolved] How to show Comments only on certain pages?

Viewing 11 replies - 1 through 11 (of 11 total)
  • I am trying to find out the same thing! I want to have comments available on certain posts…

    Plugin Author Niall Kennedy

    @niallkennedy

    You can try adding your own conditionals to trigger a comments_template filter override.
    http://plugins.trac.wordpress.org/browser/facebook/tags/1.3/facebook.php#L337

    The plugin scopes by post type. You can disable Comments Box for all post types but add it back for a post_id by replicating the code after checking is_single in your custom code.

    Why not respect the “Discussion: Allow comments.” checkbox on pages/posts?

    In plugins/facebook/socialplugins/comments.php, a simple check for comments_open() would suffice. There’s not a filter or hook there to do anything with at the moment, but it would tie in to the expected behavior.

    benklocek: That sounds like a brilliant, easy, quick fix! So what would the entire added line of code look like?

    Niall: The only issue with that, is what if I want just one post from the same post type to not have comments? benklocek’s idea of having the plugin linked to the current WordPress “Allow Comments” option seems like the easiest and best solution for you. And it seems like a really quick fix, too, no?

    Looks like Facebook::comments_box() (ln. 499 of class-facebook-comments.php) is checking if comments are open, but for some reason it’s not respecting it. The code comments are a bit cryptic, so I’m not yet sure why it’s not working.

    If I test comments_open() in my page template, it returns false, but in the plugin, it returns true. Same postID.

    Plugin Author Niall Kennedy

    @niallkennedy

    Comments Box displays both existing comments and encourages new comments. have_comments() and comments_open() wrapped into one.

    By default the plugin fetches comments from Facebook servers to include inside a noscript element on the page. If that request comes back with no comments then the plugin acting on the comments_open filter by always returning true is removed.

    @naill, thanks for the clarification. It seems that even if there are no comments from FB, it still gets added to the page.

    Just to let you guys know, I deleted the Facebook plugin and switched to Discus. It works easily as pie, and I can uncheck “Allow comments” under Discussion on a post and the comments disappear, just like I want.

    @naill It seems that even if there are no comments from FB, it still gets added to the page. Even If I have a new page, that has never had comments on, they get displayed.

    I’ve tried filtering “facebook_comments_wrapper”, so it doesn’t pull any thing from FB, but that’s doesn’t prevent it from loading also.

    Thoughts?

    “Not Resolved”

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] How to show Comments only on certain pages?’ is closed to new replies.
Skip to toolbar