Docs    Facebook    Customizations

Link to the Facebook Page of Group after loading posts X number of times

If you’d like to link users to view your Facebook page or group after loading more posts into your feed X number of times, then just add the following snippets.

First, add a class to the feed that you want to apply this to:

[custom-facebook-feed class="cff-limit-clicks"]

Then add the following JavaScript to your site. This can be done manually using a custom JavaScript plugin. For further information, see our documentation here.

var clickCount = 0,
clickLimit = 2,
linkToFacebook = 'https://facebook.com/my-page-or-group';
$('.cff-limit-clicks').on('click', '.cff-load-more', function(){
clickCount++;
if( clickCount >= clickLimit ){
$(this).after('<a href="'+linkToFacebook+'" target="_blank" class="link-to-group">View more on Facebook</a>');
$(this).remove();
}
});

Change the clickLimit number to the number of clicks on the Load More button that you want to limit the user to.

Change the linkToFacebook to be the link of your Facebook page or group that you’d like to use on the button.

Change cff-limit-clicks to whatever class you used in your shortcode.

Then add this CSS to your preferred custom CSS location or stylesheet. One option is the default additional CSS location found at WordPress Dashboard > Appearance > Customize > Additional CSS.

#cff .link-to-group{
  ​width: 100%;
  text-align: center;
  display: block;
  background: rgba(255,255,255,0.5);
  padding: 5px;
  border-radius: 5px;
​}
support

Couldn’t find your answer in the docs?

Contact Support

Was this article helpful?