所以,我的边栏在我的博客页面上运行得很好:beta版。清洁智能。然而,当你点击一篇文章时,我希望同样的边栏出现。
我想这将是在单一的。php,对吗?下面列出了该代码。如果您需要任何其他代码,请告诉我,我会将其发布在这里。
我在Wordpress的编辑页面的页面属性中有“blog”侧栏,但我想它只是没有被模板识别?
任何帮助都会很好。谢谢
<?php
get_header(); ?>
<div class="blackbar">
<div class=\'bbw\'>
Blog
</div>
</div>
<div class=\'cont-wrap\'>
<div id="primary">
<?php
$post_obj = $wp_query->get_queried_object();
$post_name = $post_obj->post_name;
if($post_name == \'blog\'){
echo \'Blog\';
}else{
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
}
?>
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( \'content\', \'archive\' ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div>
博客页面正在使用索引。php
<?php
get_header(); ?>
<div class="blackbar">
<div class=\'bbw\'>
<?php
$post_obj = $wp_query->get_queried_object();
$post_name = $post_obj->post_name;
if($post_name == \'blog\'){
echo \'Blog\';
}else{
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
}
?>
</div>
</div>
<div class=\'cont-wrap\'>
<div id="primary">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( \'content\', \'blog\' ); ?>
<?php comments_template( \'\', false ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div>
</div><!-- #main -->
这是我的侧边栏。php:
<?php
$options = twentyeleven_get_theme_options();
$current_layout = $options[\'theme_layout\'];
$nav = sb_get_page_nav($post);
if ( \'content\' != $current_layout ) :
?>
<img class="sidebar-top" src=\'<?php bloginfo(\'stylesheet_directory\'); ?>/images/sidebar-top.png\' />
<div id="secondary" class="widget-area" role="complementary">
<?php
$post_obj = $wp_query->get_queried_object();
$post_name = $post_obj->post_name;
$title = \'cs-\' . $post_name;
?>
<?php
if($post_name == \'news-events\'){
if ( ! dynamic_sidebar( \'sidebar-web\' ) ) :
endif;
}
?>
<?php if(!$nav[\'no_nav\']) { ?>
<div class="SimpleSideNav">
<?php wp_nav_menu(array(\'container_id\' => \'left-navigation\',\'menu\' => $nav[\'title\'])); ?>
</div>
<?php } ?>
<?php if ( ! dynamic_sidebar( \'sidebar-all\' ) ) : ?>
<?php endif; // end sidebar widget area ?>
<?php /*
<nav id="left-nav">
<div class="nav-wrapper">
<?php if(!$nav[\'no_nav\']) {
wp_nav_menu(array(\'container_id\' => \'left-navigation\',\'menu\' => $nav[\'title\']));
} ?>
</div>
</nav>
*/ ?>
<?php if ( ! dynamic_sidebar( $title ) ) : ?>
<?php endif; // end sidebar widget area ?>
<img class="sidebar-bot" src=\'<?php bloginfo(\'stylesheet_directory\'); ?>/images/sidebar-bot.png\' />
</div><!-- #secondary .widget-area -->
<?php endif;
$parent_title = get_the_title($post->post_parent);
if($parent_title == \'Tour\'){
echo"
<script>
jQuery(\'.w-1\').hide();
</script>
";
}
?>