在“阅读设置”中,我选择了我创建的页面的静态页面下拉菜单作为贴子页面。
我已经把html、php和css从我的页面中放了出来。索引中的php。php来设置样式。我无法获取特色图像。我用来在页面上获取它的php。php不工作。它不会呈现任何html。而且<?php the_title(); ?>
正在调出最近一篇博客文章的标题,而不是我切换过的页面的页面标题。
这就是我在page.php上生成特色图像的方式
<div class="single-image-anchor">
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), \'single-post-thumbnail\' ); ?>
<div class="single-image" style="background-image: url(\'<?php echo $image[0]; ?>\')">
<?php endif; ?>
</div>
我是Wordpress的新手,所以提前谢谢你。