我有一个wordpress网站,其中有4个页面是一个博客页面。 我已经创建了博客页面的页面模板来显示此页面上的所有博客。 在此页面模板上,我显示了其他页面中的不同侧栏。 此侧边栏显示博客档案。如何为所有博客文章和博客上载的页面显示不同的侧边栏?
但是,当我点击一个存档时,侧边栏变成了第一个侧边栏,它也在另一个页面上。
我将如何保留这个第二个边栏以显示在每篇博客文章中?
在此先感谢。
我有一个wordpress网站,其中有4个页面是一个博客页面。 我已经创建了博客页面的页面模板来显示此页面上的所有博客。 在此页面模板上,我显示了其他页面中的不同侧栏。 此侧边栏显示博客档案。如何为所有博客文章和博客上载的页面显示不同的侧边栏?
但是,当我点击一个存档时,侧边栏变成了第一个侧边栏,它也在另一个页面上。
我将如何保留这个第二个边栏以显示在每篇博客文章中?
在此先感谢。
- In case of custom pages,for example we are having aboutus.php having body contents like
this -
<?php
/**
* Template Name: About us
*
* Selectable from a dropdown menu on the edit page screen.
*/
?>
<?php get_header(); ?>
//body content for aboutus page
<?php include ('aboutus_sidebar.php'); ?>//separate sidebar for aboutus
<?php get_footer(); ?>
- Then,create a file named aboutus_sidebar.php with whatever you want.
你需要给出它应该显示在哪个小部件上的条件(在哪个页面上)。 通过获取页面ID或URL你可以给这个条件。
其他容易的选择使用插件