Aldi
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: get_cat_id and compare to cat_id in sql tableTry:
<?php if ( in_category( 'cars' ) && in_category('bmw')) { echo "Something about Cars and BMW"; } else { echo "Something else"; } ?>Forum: Fixing WordPress
In reply to: How to get parent category name?First, get the parent’s ID then the name… Something like the one below, but you should adjust it to your needs. The example below is good if you only have one sub category.
<?php foreach((get_the_category()) as $childcat) { $parentcat = $childcat->category_parent; echo get_cat_name($parentcat); } ?>Cool! I have found the SOLUTION! It’s actually very simple.
Check out this link:
http://wordpress.org/support/topic/284057?replies=8#post-1120489
Yes, I am also trying to do the same thing.
I have a post that is in a couple of subcategories and these subcategories are under different parent categories.
Let’s take amberlaine‘s example of a post:
- One parent category called “Places” with children categories called “Alberta” and “San Francisco”.
- Another parent named “Events” with children called “pizza night” and “sleepover”.
What I want is to have under the post title heading ONLY the categories under “Places” and in the sidebar ONLY lists categories from the “Events”.
The code given by jdkahn lists all the subcategories.
Is there any way I can display the subcategories from each parent separately?
This would be a great help.
Thanks in advance.
Forum: Fixing WordPress
In reply to: List recent commentsHow do you limit the number of characters (or lines, maybe) for the comments?
Forum: Fixing WordPress
In reply to: Display of archive by dateThis plug-in looks close to what you’re looking for: