There are currently, 7 guest(s) and 2 member(s) that are online.
You are Anonymous user. You can register for free by clicking here
|
|
There is a problem right now with this block.
|
|
There is a problem right now with this block.
|
|
 |
 |
Wordpress Show subcategories only under current category
Posted on Thursday, May 21 @ 13:52:18 IDT by theog |
|
I have busted my brains out to find out how to show subcategories only under the current category in wordpress. mainly there are a lot of plugins who do that, but I had a couple of problems: 1. I was working with the a different language than english - and RTL (hebrew) 2. I was working with a custome design I have made which had some changes to the classes.php file.
I have managed to perform this using a simple elseif:
in the wp-cinludes/classes.php file change:
$top_level_elements = array(); $children_elements = array(); foreach ( $elements as $e) { if ( 0 == $e->$parent_field ) $top_level_elements[] = $e; else $children_elements[ $e->$parent_field ][] = $e; }
into:
$top_level_elements = array();
$children_elements = array();
foreach ( $elements as $e) {
if ( 0 == $e->$parent_field )
$top_level_elements[] = $e;
elseif ($e->$parent_field == $_GET['cat'])
$children_elements[ $e->$parent_field ][] = $e;
}
notice the "else" is changed to: elseif ($e->$parent_field == $_GET['cat'])
good luck!
|
| |
|
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.
|
|
|