2012-12-20 121 views
1

即时通讯工作WordPress的引导theme.im使用我的网站上的主左侧栏我把代码到WIDGETS> MainSidebar,但现在我有一个问题,点击一个链接,我想打开另一个页面与我的主页相同,但不同的sidebar.how我可以实现它?我们如何添加另一个左侧边栏到我们的网站

这里是我的自举模板:页面模板(page.php文件)

<?php 
/** page.php 
* 
* The template for displaying all pages. 
* 
* This is the template that displays all pages by default. 
* Please note that this is the WordPress construct of pages 
* and that other 'pages' on your WordPress site will use a 
* different template. 
* 
* @author  Konstantin Obenland 
* @package  The Bootstrap 
* @since  1.0.0 - 07.02.2012 
*/ 

get_header(); ?> 

<div id="primary" class="span9"> 
    <?php tha_content_before(); ?> 
    <div id="content" role="main"> 
     <?php tha_content_top(); 

     the_post(); 
     get_template_part('/partials/content', 'page'); 
     comments_template(); 

     tha_content_bottom(); ?> 
    </div><!-- #content --> 
    <?php tha_content_after(); ?> 
</div><!-- #primary --> 

<?php 
get_sidebar(); 
get_footer(); 


/* End of file page.php */ 
/* Location: ./wp-content/themes/the-bootstrap/page.php */ 

回答

1

您必须有两个不同的侧边栏。 将自定义模板中的侧边栏代码命名为您喜欢的名称。

了解如何创建自定义模板link

,并使用像WordPress条件标签。

 
if(is_page(2)){ // 2 is page id 
get_template_part('custom', 'sidebar'); // (custom-sidebar.php) 
} 
else{ 
get_sidebar(); 
} 

conditionnal tags

通过这种方式,您可以有不同的页面侧边栏2。

+0

thnks很多老兄.......现在试试吧 –

+1

欢迎您。我尽我最大的帮助:) –

+0

我已经尝试过,但没有成功IT.can你告诉我,因为在我的page.php模板我有get_sidebar所以现在我可以通过它做另一个边栏,然后可以使用条件标签对于它,但即时通讯无法发现,从这里get_sidebar()函数来? –

相关问题