Php 背景图片未出现在Wordpress 4.75中的博客页面上
有人能告诉我这些功能图片是如何出现在博客页面上的吗。我已经将我的博客嵌入index.php中,并浏览了各种论坛,但无法显示图像。我正在使用下面的代码-Php 背景图片未出现在Wordpress 4.75中的博客页面上,php,html,wordpress,Php,Html,Wordpress,有人能告诉我这些功能图片是如何出现在博客页面上的吗。我已经将我的博客嵌入index.php中,并浏览了各种论坛,但无法显示图像。我正在使用下面的代码- <div id="main" > <section class="feature-image feature-image-default-alt" > <h1 class="page-title">Blog</h1> </section> <!-- BLOG
<div id="main" >
<section class="feature-image feature-image-default-alt" >
<h1 class="page-title">Blog</h1>
</section>
<!-- BLOG CONTENT
================================================== -->
<div class="container">
<div class="row" id="primary">
<main id="content" class="col-sm-8" role="main">
<?php
if ( have_posts() ) :
if ( is_home() && ! is_front_page() ) : ?>
<header>
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
</header>
<?php
endif;
/* Start the Loop */
while ( have_posts() ) : the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
</main><!--content-->
<!-- SIDEBAR
================================================== -->
<aside class="col-sm-4 asidebar">
<?php get_sidebar();?>
</aside>
</div><!--primary-->
</div><!--container-->
博客
Wordpress具有以下功能:
while ( have_posts() ) : the_post();
$featured_img_url = get_the_post_thumbnail_url();
echo '<img src="'.$featured_img_url.'">';
while(have_posts()):the_post();
$featured\u img\u url=获取文章缩略图\u url();
回声';
Hi@user8242904,很高兴它起作用了。你能接受正确的答案吗?