我有一个wordpress网站,有4页,一页是博客页面。 我为博客页面创建了一个页面模板,以显示此页面上的所有博客。 在此页面模板上,我显示与其他页面不同的侧边栏。 此侧栏显示博客档案。
但是当我点击存档时,侧边栏会更改为第一个侧边栏,也会在另一个页面上。
我将如何保留第二个侧边栏以显示在每篇博文上?
提前致谢。
答案 0 :(得分:0)
您需要在每个窗口小部件上显示它应显示的条件(在哪个页面上)。 通过获取页面ID或网址,您可以提供此条件。
其他简易选项使用插件
答案 1 :(得分:0)
答案 2 :(得分:0)
- 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.