2013-12-17 3 views
0

내 블로그 사이드 바는 내 블로그 페이지에서 잘 작동하고 있습니다 : beta.cleantelligent.com/blog 그러나 단일 게시물을 클릭하면 같은 사이드 바를 표시하고 싶습니다.single.php에있는 WordPress 사이드 바

저는 이것이 single.php에 있다고 가정합니다. 맞습니까? 해당 코드는 다음과 같습니다. 다른 코드가 필요한 경우 알려 주시면 여기에 게시하겠습니다.

저는 Wordpress의 편집 페이지에서 내 페이지 속성에 '블로그'사이드 바를 가지고 있지만 템플릿에 의해 인식되지 않습니다.

도움이 될 것입니다. 감사!

<?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> 
"; 
} 
?> 
+0

어떤 템플릿이 블로그에서 사용됩니까? – Sabari

+0

머리말에 내 사이드 ​​바를 넣으면 모든 페이지에 표시되지만 '위치 : 고정'을 사용하고 있으므로 위치가 필요한 곳이 필요한지 모르겠습니다. –

+0

블로그에서 index.php를 사용하고 있습니다 – JCKnoell

답변

0

내가 사이드 바 블로그에서 새로운 기사를 작성하여 그것을 고정 :

<?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로 리디렉션합니다.

관련 문제