Не получается вызвать индивидуальный шаблон для катег
-
Доброго дня
Пытаюсь для индивидуальной категории сделать вызов дополнительного шаблона записи. Вот полный код single.php. Тема deco_fleximag.<?php if ( in_category('chavo') ) { include 'single2.php'; } else { <?php get_header(); ?> <div class="art-content-layout"> <div class="art-content-layout-row"> <div class="art-layout-cell art-content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $prev_link = get_previous_post_link('« %link'); $next_link = get_next_post_link('%link »'); ?> <?php if ($prev_link || $next_link): ?> <div class="art-post"> <div class="art-post-tl"></div> <div class="art-post-tr"></div> <div class="art-post-bl"></div> <div class="art-post-br"></div> <div class="art-post-tc"></div> <div class="art-post-bc"></div> <div class="art-post-cl"></div> <div class="art-post-cr"></div> <div class="art-post-cc"></div> <div class="art-post-body"> <div class="art-post-inner art-article"> <div class="art-postcontent"> <!-- article-content --> <div class="navigation"> <div class="alignleft"><?php echo $prev_link; ?></div> <div class="alignright"><?php echo $next_link; ?></div> </div> <!-- /article-content --> </div> <div class="cleared"></div> </div> <div class="cleared"></div> </div> </div> <?php endif; ?> <div class="art-post"> <div class="art-post-tl"></div> <div class="art-post-tr"></div> <div class="art-post-bl"></div> <div class="art-post-br"></div> <div class="art-post-tc"></div> <div class="art-post-bc"></div> <div class="art-post-cl"></div> <div class="art-post-cr"></div> <div class="art-post-cc"></div> <div class="art-post-body"> <div class="art-post-inner art-article"> <?php $page_title = get_post_meta($post->ID, 'page_title', TRUE); ?> <?php if (!$page_title == 'No') { ?> <h2 class="art-postheader"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"> <?php the_title(); ?> </a> </h2> <?php } ?> <?php $icons = array(); ?> <?php if (!is_page()): ?><?php ob_start(); ?><?php the_time(__('F jS, Y', 'kubrick')) ?> <?php $icons[] = ob_get_clean(); ?><?php endif; ?><?php if (!is_page()): ?><?php ob_start(); ?><?php _e('Author', 'kubrick'); ?>: <?php the_author_posts_link() ?> <?php $icons[] = ob_get_clean(); ?><?php endif; ?><?php if (0 != count($icons)): ?> <div class="art-postheadericons art-metadata-icons"> <?php echo implode(' | ', $icons); ?> </div> <?php endif; ?> <div class="art-postcontent"> <div class="yashare-auto-init" data-yashareLink="" data-yashareTitle="" data-yashareDescription="" data-yashareImage="" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,gplus" data-yashareTheme="counter" data-yashareType="small"></div> <!-- article-content --> <?php if (is_search()) the_excerpt(); else the_content(__('Read the rest of this entry »', 'kubrick')); ?> <?php if (is_page() or is_single()) wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <!-- /article-content --> </div> <div class="cleared"></div> <?php ob_start(); ?> <?php $icons = array(); ?> <?php if (!is_page()): ?><?php ob_start(); ?><?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> <?php $icons[] = ob_get_clean(); ?><?php endif; ?><?php if (!is_page() && get_the_tags()): ?><?php ob_start(); ?><?php the_tags(__('Tags:', 'kubrick') . ' ', ', ', ' '); ?> <?php $icons[] = ob_get_clean(); ?><?php endif; ?><?php if (!is_page() && !is_single()): ?><?php ob_start(); ?><?php comments_popup_link(__('No Comments »', 'kubrick'), __('1 Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?> <?php $icons[] = ob_get_clean(); ?><?php endif; ?><?php if (0 != count($icons)): ?> <div class="art-postfootericons art-metadata-icons"> <?php echo implode(' | ', $icons); ?> </div> <?php endif; ?> <div class="related_posts"> <hr/> <h3>Краткий обзор статей из данной рубрики</h3> <?php $categories = get_the_category($post->ID); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; $args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'showposts'=>3, 'orderby'=>rand, 'caller_get_posts'=>1); $my_query = new wp_query($args); if( $my_query->have_posts() ) { echo '<ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><hr/><?php the_title(); ?></a><?php the_excerpt(); ?> <?php } echo '</ul>'; } wp_reset_query(); } ?></div> <?php $metadataContent = ob_get_clean(); ?> <?php if (trim($metadataContent) != ''): ?> <div class="art-postmetadatafooter"> <?php echo $metadataContent; ?> </div> <?php endif; ?> </div> <div class="cleared"></div> </div> </div> <?php comments_template(); ?> <?php endwhile; ?> <?php else: ?> <h2 class="center"><?php _e('Sorry, no posts matched your criteria.', 'kubrick'); ?></h2> <?php endif; ?> </div> <?php include (TEMPLATEPATH . '/sidebar1.php'); ?><?php include (TEMPLATEPATH . '/sidebar2.php'); ?> </div> </div> <div class="cleared"></div> <?php get_footer(); ?> } ?>
Шаблон single2.php создан. Я отключил в нем sidebar1 и sidebar2 для того чтобы отличить шаблоны. При переходе http://broneplenka.biz/category/chavo/ нет происходит изменений. Может проблема в пути category? Если да — то как исключить?
Просмотр 3 ответов — с 1 по 3 (всего 3)
Просмотр 3 ответов — с 1 по 3 (всего 3)
- Тема «Не получается вызвать индивидуальный шаблон для катег» закрыта для новых ответов.