I'm having trouble with a Wordpress plugin called 'Social Feed Gallery' that imports my instagram images to a website gallery. I'm trying to remove certain photos / elements (each image container has the class 'insta-gallery-item') when the data-item contains the hashtag 'remove_me'.
Here's an example of the MESSY HTML
<div id="insta-gallery-feed">
<div class="insta-gallery-inner">
<div id="insta-gallery-item-17972204888477284" class="insta-gallery-item" data-item="{hashtags":["isleofskye","remove_me","ferry","mountains","ferrydogs","scotland","coastalwaters","scottishlandscape","Glenelg","ferry","overthrseatoskye","sailing","scotland","visitscotland","instascotland","nature","scotlandshots","lovescotland","nathistships"],"link":"}" data-elementor-open-lightbox="no">
<img src="image-is-here.jpg">
</div>
</div>
</div>
Here's my JQUERY
<script>
(function($) {
$(document).ready(function() {
$('#insta-gallery-feed').find('.insta-gallery-item').each(function() {
if ($(this).data('item').indexOf('remove_me') !== -1) {
$(this).hide();
}
});
});
})(jQuery);
</script>
Doesn't seem to work, also tried this one; Hide element if data contains specific piece of text?
[data-item="remove-me"] {display: none;}
[data-item*="remove_me"] {display: none;}
should work