Hi Viktor,
The option to disable the Facebook Comments for individual post/page disables only the Facebook Comments box that is there at that particular webpage because of the inbuilt placement options of the plugin. That option won’t work for the shortcode. If you are using shortcode, you can apply condition in the code to check if the current webpage is the one where you want to disable the Facebook Comments. For example –
if ( $post_id != 45 ) {
// enable Facebook Comments at all posts except that with post ID 45
echo do_shortcode( '[Fancy_Facebook_Comments]' );
}
Thanks for the reply, but that is highly unpractical. Instead it would be nice to be able to use a function, which would obey the option to disable comments box per post. Is there a function to use instead of the shortcode?
Shortcodes are always independent of the options. Why can’t you check the post/page ID and use shortcode only at the pages you want?
Hardcode post IDs is no go, especially if it’s a client site. No way the client calls me every week to add another ID to the list (I have like 10.000 posts on each of 3 sites).
In a situation, where the post footer gets this crowded with all the sharing buttons, comments and related posts it’s really important to be able to put the function where I want and have all the options working. So if there’s any voting, I’m up for a function or class.
You don’t need to place post ID hardcoded. The code was just for the demo.
If you want to check if the Facebook Comments are disabled for a particular post/page via the post meta option in the “Edit” section of that page/post, you can use following code:
global $post;
if ( $post ) {
$heateor_ffc_post_meta = get_post_meta( $post->ID, '_heateor_ffc_meta', true );
if ( isset( $heateor_ffc_post_meta['facebook_comments'] ) && $heateor_ffc_post_meta['facebook_comments'] == 1 ) {
// Facebook Comments are disabled for this webpage
}
}
Thanks for bringing this to my attention, haven’t though of this kind of solution.
It works as advertised now, thanks for the excellent support.