我继承了这个项目,原来的设计师早就不在了。我对Wordpress不是很熟悉。
在这个页面上,我不知道这个侧边栏是如何生成的。我grep
'搜索了整个目录,寻找诸如"Bill Johnson"或"Rocky Mountain News"之类的内容,但它不在Wordpress文件中。因此,它必须成为数据库的一部分。
但该网站没有小部件或帖子。在页面下,我看不到包含侧边栏的选项。
以下是wp-content/themes目录中的代码。
sidebar.php:<?php print get_post_meta($post->ID, "sidebar_var", true); ?>
page.php:
<div id="content">
<div id="left">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content('Read the rest of this entry »'); ?>
<?php endwhile; ?>
<?php else : ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
<!-- End #left --><br class="cl" /></div>
<?php get_sidebar();?>
<!-- End #content --><br class="cl" /></div>
<?php get_footer();?>
非常感谢任何指导。
根据Cthulhu的建议,在检查数据库时,wp_postmeta
表中有一条记录,其中meta_key
字段设置为值sidebar_var
。同一条记录的meta_value
字段具有侧边栏html。不知道最初的设计者为什么要这样做,但我会重构以使用小部件。