Docs    Facebook    Customizations

Creating a dynamic Like Box

If you’re using a multifeed then you may want to either change which Like Box is being shown based on the first post in the feed, or you may want to add a Like Box to each post.

Add a Like Box for the author of the first post shown in the feed

1) First add a class to your feed by adding the following to the shortcode class="cff-dynamic-likebox"

2) Make sure to disable the existing Like Box, which can be done by adding the following to the shortcode exclude="likebox"

3) Add the following to the plugin’s Custom JavaScript section (Facebook Feed > Customize > Misc):

$('.cff-dynamic-likebox').append('<iframe src="https://www.facebook.com/plugins/page.php?adapt_container_width=true&app_id=712681982206086&container_width=181&hide_cover=true&hide_cta=false&href=https%3A%2F%2Fwww.facebook.com%2FAndromedabarnehage&locale=nb_NO&sdk=joey&show_facepile=false&show_posts=false&small_header=true&href=https%3A%2F%2Fwww.facebook.com%2F'+$('.cff-dynamic-likebox .cff-item').first().attr("data-cff-from")+'" style="width: 100%; height: 70px;"></iframe>');
});

Add a Like Box to each post in a multifeed

To do this use the snippet below instead of the one above:

$('.cff-dynamic-likebox .cff-item').each(function(){ 
$(this).append('<iframe src="https://www.facebook.com/plugins/page.php?adapt_container_width=true&app_id=712681982206086&container_width=181&hide_cover=true&hide_cta=false&href=https%3A%2F%2Fwww.facebook.com%2FAndromedabarnehage&locale=nb_NO&sdk=joey&show_facepile=false&show_posts=false&small_header=true&href=https%3A%2F%2Fwww.facebook.com%2F'+$(this).attr("data-cff-from")+'" style="width: 100%; height: 70px;"></iframe>');
});
support

Couldn’t find your answer in the docs?

Contact Support

Was this article helpful?