【发布时间】:2017-04-05 17:01:20
【问题描述】:
我的代码是
<?php
// Template Name: homepage
get_header(); ?>
<div id="content" class="full-width">
<?php
query_posts(array(
'post_type' => 'avada_portfolio',
'showposts' => 2
) );
?>
<?php while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<img src=" <?php the_post_thumbnail('medium'); ?>">
<p><?php echo get_the_excerpt(); ?></p>
<?php
endwhile; //resetting the page loop
wp_reset_query(); //resetting the page query
?>
<h1 class="entry-title"><?php the_title(); ?></h1> <!-- Page Title -->
<?php
// TO SHOW THE PAGE CONTENTS
while ( have_posts() ) : the_post(); ?> <!--Because the_content() works only inside a WP Loop -->
<div class="entry-content-page">
<?php the_content(); ?> <!-- Page Content -->
</div><!-- .entry-content-page -->
<?php
endwhile; //resetting the page loop
wp_reset_query(); //resetting the page query
?>
<?php get_footer(); ?>
我已将<?php add_theme_support( 'post-thumbnails' ); ?> 添加到函数中,但它只是在我的主页上显示一个损坏的图像:(
我所有的图片都上传到我的 wordpress 网站上,并在自定义帖子上设置为特色图片!
谢谢
【问题讨论】:
-
the_post_thumbnail('medium');写出图片标签
标签: wordpress-theming wordpress