Sub category not displaying properly
Hi all, hope someone can help – this should be easy for anyone who knows PHP – unfortunately I dont have a clue!
I have a two level menu with categories and sub categories. I want the sub categories to be displayed when the main category is active.
I adapted the following code from another source except it was set up for pages so I am not sure if it is correct. At present the correct sub categories display but won’t disappear when you move to another category.
By the way Category 4 is the category I want to display the sub categories from
$thiscategory = $wp_query->post;
The same plugin author from where you got your Pages code… has a plugin for categories:
Thanks, yeah I knew about this – but he doesn’t have anything similar for categories – I can’t find anything to help. I just don’t understand what all this means:
$thiscategory = $wp_query->post;
but he doesn’t have anything similar for categories
I hate when people talk back without clicking on the resources I offered. The link I gave you above is for collapsable categories!
I did check the link but it doesn’t solve my problem, I am already using that plug in but the site is pretty low on details about how to implement it, particularly in an IF statement. As mentioned before I have no clue about PHP and just need to try and understand this code I have.
If no clue about PHP – you shouldn’t mess with the code.
Why do you need an IF statement, why doesn’t the plugin work for you as is?
You don’t “implement” a plugin. You upload, activate and use it: in this case replace WP’s category template tag with the one suggested in the readme. Done.
What is so complicated?
There is no readme with the zip. I need the IF statement to make the menu work, just like the one based on pages needed an IF statement the one for the categories does too surely?
None of them needs any IF statement.
There is a detailed instruction for Usage on the plugin’s page. WHY do you need the IF…? I still don’t get it. (maybe I am not the only one)
Perhaps I wasn’t clear – it’s just I have navigation with both pages and categories running side by side.
Currently the sub categories display but wont go away when I move away from that category
Sub Page 1
Sub Page 2
Both subs appear when they shouldn’t, it’s just the lack of complaince between pages and categories which forces me to use the IF.
I just need a way to exclude the sub categories when the parent is not active
Pretty sure the problem lies in this line here:
Did you contact me (the author of the plugin)? I don’t recall seeing anything in my mail… there’s an email address in the header of the plugin…
Anyway… I’m a little confused by what you mean by all this… You also seem to be mixing categories and pages/posts and I’m not sure the if… else (which afterall was created for handling pages) is doing what you think it is doing.
If the tested value is non-zero then the plugin will show the (sub-)categories of whatever that value is. If the tested value is zero it will display for catregory ‘4’.
I suspect that you are getting non-zero values where you expect to have zero, and maybe even zero where you expect to have non-zero.
- The topic ‘Sub category not displaying properly’ is closed to new replies.