May 11, 2011

Wordpress - detecting the categories of a post

I was creating a Wordpress child theme (the best way to modify/override your themes) tonight and had the need to have different display options depending on which categories the blog article had. So for example if I had a post categorised with “portfolio”, I wanted to hide the comments form which usually sits at the bottom of a post. The following snippet will loop over all post categories, if it finds that “portfolio” is one of the categories assigned to the current post then a local variable (boolean) is set which you can use to hide Wordpress functions anywhere in the current template. ... Read more

May 11, 2011

FancyBox for Wordpress plugin not working

I just spent some time figuring out why fancybox wasn’t working tonight (image thumbnails were just linking to the large image…not loading the overlay as they should). It now seems obvious after the fact but as far as I can see it’s NOT in the fancybox docs. When you insert your gallery from the media section of a page in wp-admin, you HAVE to choose “Image File”, not “Attachment Page”. That’s it! ... Read more

© Michael Sharman 2017