Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
single.php上的WordPress侧栏_Php_Wordpress_Templates_Sidebar - Fatal编程技术网

single.php上的WordPress侧栏

single.php上的WordPress侧栏,php,wordpress,templates,sidebar,Php,Wordpress,Templates,Sidebar,所以,我的边栏在我的博客页面上运行得很好:beta.cleantelligent.com/blog 然而,当你点击一篇文章时,我希望同样的边栏出现 我想这应该在single.php下,对吗?下面列出了该代码。如果你需要任何其他代码,请告诉我,我会在这里发布 我在Wordpress的编辑页面的页面属性中有“blog”边栏,但我猜它只是没有被模板识别 任何帮助都会很好。谢谢 <?php get_header(); ?> <div class="blackbar"> <

所以,我的边栏在我的博客页面上运行得很好:beta.cleantelligent.com/blog 然而,当你点击一篇文章时,我希望同样的边栏出现

我想这应该在single.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>
博客页面正在使用index.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 -->
这是我的sidebar.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>
";
}
?>

我通过在sidebar-blog.php下创建一个全新的侧栏并将模板重定向到它来修复它。

博客使用哪个模板?我将侧栏放在标题中,它显示在每个页面上,但是我使用的是position:fixed,所以我不知道你是否需要它,在你有它的地方定位博客正在使用索引。php@JCKnoell查看index.php。。。它有什么用呢?是这样的,还是在@JCKnoell和add your index.php代码之间有什么东西