【发布时间】:2013-10-07 12:32:44
【问题描述】:
我继承了这个项目,原来的设计师早已不在。而且我对 Wordpress 不是很熟悉。
在this page 我不知道这个侧边栏是如何生成的。我grep'ed 整个目录寻找诸如“Bill Johnson”或“Rocky Mountain News”之类的内容,但它不在 Wordpress 文件中。所以,它必须是数据库的一部分。
但该网站没有小部件或帖子。在 Pages 下,我没有看到包含侧边栏的选项。
这是 wp-content/themes 目录中的代码。
侧边栏.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();?>
非常感谢任何指导。
【问题讨论】:
-
查看您的页面源代码,它看起来可能是硬编码的。您是否查看过 get_sidebar();看看它是否在那里?
-
正如您从 Codex (codex.wordpress.org/Function_Reference/get_post_meta) 中看到的那样,
get_post_meta从自定义字段中获取内容。尝试转到 wordpress 后台的那个页面,那里可能有一些包含该信息的自定义字段。 -
发布sidebar.php的内容。这很可能是生成右侧 HTML 的位置。