witi22
Member
Posted 7 months ago #
Hi people !
I currently have a strange problem with the category / childs categories mechanical.
If i ask by Url something like this : http://www.website.com/?cat=844, Wp display a child of this category. See when i print_r the result of get_the_category.
Array ( [0] => stdClass Object ( [term_id] => 854 [name] => xxxxx [slug] => xxxxx [term_group] => 0 [term_taxonomy_id] => 854 [taxonomy] => category [description] => [parent] => 844 [count] => 31 [object_id] => 195 [cat_ID] => 854 [category_count] => 31 [category_description] => [cat_name] => xxxxx [category_nicename] => xxxxx [category_parent] => 844 ) )
Well, i have ever tried to disable all plugins. No change.
And my category (844) is not empty.
If i ask by Url something like this : http://www.website.com/?cat=844, Wp display a child of this category
this is standard behaviour - a category archive does show posts of the category and its children categories;
to change this you need to edit category.php (create it from a copy of archive.php if it does not yet exists) and add a line with a query before the start of the loop;
example:
<?php global $wp_query;
$args = array_merge( $wp_query->query, array( 'category__in' => array(get_query_var('cat')) ) );
query_posts( $args ); ?>
witi22
Member
Posted 7 months ago #
Ty for that fast reply :)
unfortunately that won't really solve my problem.
To the end i'd like to show a page content in parents categories, using plugin page2cat.
So i wont use the loop on those cats :s
if(is_category() && !is_category('3') && $cat[0]->parent!=3){
// Show page content .
// Working for others categories except 844
}
else{
// use the loop
}
See what i want to do ? and why this let me perplex ...
witi22
Member
Posted 7 months ago #
Bump ?
[please don't bump - it's not working]