determine if permalink is category or not in header.php
-
i’m trying to make a header only build a submenu on pages and category archives… i use a permalink structure, /%cateory%/%posttitle%/
if a word is typed in the URL, it should display no menu, but instead i’m getting database errors. i can’t figure out how to determine if a word is a category or page title or not.
this is the order of events:
if (!$wp_query->is_admin || is_home()) {
// do stuff you can't do in wp-admin
// new loop if/else within this:
if (is_page()) {
// this must be a page
} else if (is_category()) {
// this must be a category
//get values from database for parent, and category info
}
}BUT, it’s not working as expected…
If I type in
demo2.sligoarts.com/anything i get the database error, because it defaults to the category.phphow can i determine if a word is/isnot a category? my brain is fried ??
- The topic ‘determine if permalink is category or not in header.php’ is closed to new replies.