[Plugin: HungryFEED] Apply custom classes/attributes to parsed elements
-
First of all, thanks for giving us HungryFEED, it really solves any problems for customizing feeds as we want them.
I am trying to configure a custom display and behavior of Google news feed in a site I am creating. I have found what div of the feed to select (excluding the images on feed items). The problem is that the links do not have a target attribute set, so they open in same browser tab.
I solved this easily with some javascript help. Maybe not the best and fastest solution, but it does the job.1st, in custom template I used:
<div class="hungryfeed_item" onmouseover="changeHFaTag()">
2nd, in page with (HTML) I used:<script type="text/javascript"> function changeHFaTag() { var HF_items = document.getElementsByClassName('hungryfeed_item'); for (var i=0; i<HF_items.length; i++) { var FHitem_atags = HF_items[i].getElementsByTagName('a'); for (var t=0; t<FHitem_atags.length; t++) { FHitem_atags[t].target = "_blank"; } } } </script>
That took care of opening links in new tabs.
Then I tried to extend the same logic to use Easy FancyBox plugin, by using the usual class name “fancybox iframe” for a tags.
So, I addedFHitem_atags[t].className = "fancybox iframe";
in the tags loop.
The class name changes (is created actually) just fine, but FancyBox does not work and it doesn’t open an iframe for the link.Do you have any ideas what is going on?
I am not a php/html/javascript expert, so I suspect I am missing something …Is it possible for HungryFEED to have some options to insert parameters for the elements we read from feeds? Or even use shortcodes to wrap them with.
This will open up many formatting options if you consider the number of available plugins we can use to do this job.
- The topic ‘[Plugin: HungryFEED] Apply custom classes/attributes to parsed elements’ is closed to new replies.