Determine if term is Category or Tag

Solution below 🙂 I when through how WordPress determines if the term is category or tag. I found that there is an attribute called ‘hierarchical’ – it went down the hill from there. I found a nice little function called is_taxonomy_hierarchical() and I fixed the issue with two if statements. if(is_taxonomy_hierarchical($taxonomy)) { if(isset($term[0]->name)) { if($term[0]->parent … Read more

Add style to body based on url

for your home page: On index.php or your home page custom file use: if (is_home()){ echo ‘hi home!’; } for any other page except 404: use the file page.php or the custom one: for example the link is www.xyz.pt/chat/ if (is_page(‘chat’)){ echo ‘hi page!’; } for page 404: if (is_404()){ echo ‘hi error 404’; }