Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mmarj/a93168c836f4c10fb4bb6f2a95ade5d7 to your computer and use it in GitHub Desktop.
Save mmarj/a93168c836f4c10fb4bb6f2a95ade5d7 to your computer and use it in GitHub Desktop.
Add a border to any Facebook post which has more than 3 likes. It will apply to only this specific feed.
/*
@ Usecase: Add a border to any Facebook post which has more than 3 likes. It will apply to only this specific feed.
@ Required plugin: https://wordpress.org/plugins/custom-facebook-feed/
@ Install [this plugin](https://wordpress.org/plugins/custom-css-js/) to inject custom CSS/JS code snippets into a WordPress site.
*/
jQuery(document).ready(function($) {
$(".cff-likes .cff-count").each(function() {
var el = $(this);
var value = parseFloat(el.text());
if(value > 3) { //if Facebook posts have more than 3 likes, add the following style
el.parents(".cff-meta-wrap").prev().prev().css({
"border": "1px solid red",
"border-radius": "10px",
"padding": "3px"
});
} else {
el.css({
"border": "none",
"padding": "3px"
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment