Here is another great WordPress function to test if you are in a subcategory or the actual parent category and if so return true. This function is pretty much identical in concept to the is_page_or_sub() function I released previously. However, it just tests categories and not pages. Also, the code is significantly different since there are a few more available pre existing function we can build upon here.
For example, the cat_is_ancestor_of() function comes in really handy and does a lot of the heavy lifting for this simple but very powerful function. I use this very function to build complex category based navigation and ...
Is Category or Subcategory WP Function
April 29th 2009
Is Page or Subpage WP Function
March 21st 2009
Have you ever wanted to know if the page you're on is a child of a certain page because you needed to know that information in order to add a snippet of code to the sidebar or remove something or whatever you had planned but you tried and just couldn't figure out a solution that was simple and easy to maintain? Well, here is a piece of code that will do just that. I use this very code all over the place, on pretty much every project I do. The concept is simple. I need to know more than if the is_page('portfolio'); I ...





