my code is
<?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(); ?>
I have added the <?php add_theme_support( 'post-thumbnails' ); ?>
to functions however it just shows a broken image on my home page 🙁
All my images are uploaded onto my wordpress site and set as featured images on the custom post!
thanks
the_post_thumbnail('medium')
this function will returnimg tag
with feature image.So you can get image following two ways:-
OR just this function :-
<?php the_post_thumbnail('medium'); ?>
Hope this will help you.
This does not work in
<img src="">
. For me this worked:write “the_post_thumbnail(‘medium’);” out of the image tag
Like this: