Deniska
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Problem with displaying child categories.I do not know what I changed in the code, but now the subcategory are displayed along with all other posts from the parent category and the other subcategories. When I click on a subcategory, the page just reloads, and should include only those who belong to this subcategory. Maybe in code something is wrong. I did not notice the error. Codex doesn’t help. Please help to understand.
Portfolio.php<?php /* Template Name: Portfolio */ ?> <?php get_header() ?> <?php $catid = 4,5,6; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('cat='.$catid.'&paged='.$paged); $wp_query->is_archive = true; $wp_query->is_home = false; ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="Content"> the_excerpt(); </div> <?php endwhile; ?> <?php else : ?> <h2 class="post-title"><?php _e('404 - Not Found'); ?></h2> <p><?php _e('Nothing's found.'); ?></p> <?php endif; ?> <?php get_footer() ?>
And code for category portfolio template in functions.php
add_filter( 'category_template', 'my__template' ); function my_template( $template ) { $catid = 4,5,6; $catid = strpos( $catid , ',' ) ? explode( ',' , $catid ) : array( (int) $catid ); if( is_category( $catid ) ) $template = locate_template( array( 'portfolio.php') ); else $template = locate_template( array( 'category.php' ) ); return $template; }
Whats wrong? Thanks!
Forum: Fixing WordPress
In reply to: Can’t get data from arraySorry for insolence, maybe you can explaine how to resolve This problem.
Past few week trying to resolve this problem.Forum: Fixing WordPress
In reply to: Can’t get data from arrayMan THANK YOU VERY MUCH. You’re a good man. Thanks for this help.
Forum: Fixing WordPress
In reply to: Can’t get data from arrayI’ll try to make this. This isn’t work.
add_filter( 'single_template', 'my_template' ); function my_template( $template ) { $catid = get_option('imp_cat'); if ( in_category(array($catid)) ) $template = locate_template( array( 'single-port.php' ) ); return $template; }
I dont understand about explode and how to get this work with my function.
Forum: Fixing WordPress
In reply to: Can’t get data from arrayinside categories id’s 4,5,6. I’m put this id’s in my theme options.
imp_cat
thats a options textfield id. In this textfield I put categories ID’s -4,5,6. Before this in all other cases all works is fine but this code isn’t work.Forum: Fixing WordPress
In reply to: removing sub category posts from category on home pageooopps. All working is fine with category__not_in but some posts that not in category 5 exclude too. I dont understand why?
Forum: Fixing WordPress
In reply to: removing sub category posts from category on home pageHi esmi! Please help me understand why category__in and category__not_in doesnt exclude my child category from loop. I’m try to use this code.
<?php $limit = 6; query_posts(array('category__in' =>array(5),'posts_per_page'=>$limit)); if (have_posts()) : while (have_posts()) : the_post(); ?> <!---stuff here--> <?php endwhile; ?> <?php endif; ?>
Thank you!
Forum: Fixing WordPress
In reply to: Exclude Categories In Parent?Please tell me how to exclude only one or two child categories not all?
Forum: Fixing WordPress
In reply to: Problem with displaying child categories.Maybe you can explain how to make This filter by category? Thank you!
Forum: Fixing WordPress
In reply to: Problem with displaying child categories.May I do this without plugins? Maybe few hacks?