SaltwaterC
Member
Posted 4 years ago #
Is there an elegant manner of placing the RSS image link before the category name when fetching the cats with wp_list_categories(); or do I have to actually start writing some code? After hours of Goggling and searching, I still didn't find a solution for this issue.
Well, the "elegant" solution here would require some code writing. The following bit should work for you; replace wp_list_categories() in your template(s) with the following -- modify the parameters to match what you use, but retain &echo=0:
<?php
$catslist = wp_list_categories('feed=rss&feed_image=/images/feed.gif&echo=0');
echo preg_replace('%(<a .*</a>) (<a .*<img .* /></a>)%', '\\2 \\1', $catslist);
?>
SaltwaterC
Member
Posted 4 years ago #
Thanks a lot, it works fine. What can I say ... you're the man and I hate RegEx :) ...
PS: it doesn't work with WP 2.2.3 though ... I had to upgrade my 'production' installation.
lagosmike
Member
Posted 4 years ago #
Thanks a lot. Works fine in WP 2.5.
But how get I rid of the bullet at the beginning of the list?