Created
June 13, 2022 17:10
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@ 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