Wordpress: exclude subcategories
If you are looking for a solution to exclude subcategories, here is a very simply way:
$categories= get_categories(); foreach ($categories as $cat) { if($cat->category_parent == 0){ DO WHATEVER YOU WANT TO DO } }
You could use this code to make a dropdown box without subcategories.
Here is the wordpress reference for “get_categories” with an example of a categories dropdown box.
Dropdown box
Like our posts? Then subscribe via Mail:
Similar Posts:
- PageNavi not working on front page if you exclude categories
- Wordpress: Reorder Pages Plugin
- Wordpress save tag in PHP var!
- Word to Wordpress – Copy & Paste Text from Word to Wordpress
- Wordpress: Conditional Tags
Socialize:
|
|










Thank you so much, I was about to give up my search! This helped me extend this: http://playworkplay.com/blog/w.....y-listing/
Thank you
Leave your response!
Best E-Mail Marketing
Try AWeber Email Marketing Risk-Free
Useful Pages
Categories
Latest Entries
Recent Comments
Site Archives
Latest Forum Threads
TwiTwiTwitter
Twitter Updates
follow me on Twitter
Sponsored Results