WordPress.org

Ready to get started?Download WordPress

Forums

Featured posts with image on a static page? (1 post)

  1. Slasken
    Member
    Posted 11 months ago #

    Hey!

    I'm trying to style an excerpt with three latest posts on a page that is set to be the homepage.
    I just cant figure out how to pull the featured image. The posts has to be inline with each other with the image on top.

    This is my page-frontpage.php

    <?php
    /*
    	Template Name: Frontpage
    */
    ?>
    <?php get_header(); ?>
    
    </div>
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', 'page' ); ?>
    
    			<?php endwhile; // end of the loop. ?>
    
    <div id="main" class="wrapper">
    
    	<article id="frontpage-featured">
    		<?php
    		$temp = $wp_query; $wp_query= null;
    		$wp_query = new WP_Query(); $wp_query->query('cat=6&showposts=1' . '&paged='.$paged);
    		while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    		<h2><a>" title="Read more"><?php the_title(); ?></a></h2>
    		<?php the_excerpt(); ?>
    
    		<?php endwhile; ?>
    
    		<?php wp_reset_postdata(); ?>
    
    	</article>
    
    	<article id="frontpage-kund">
    		<?php
    		$temp = $wp_query; $wp_query= null;
    		$wp_query = new WP_Query(); $wp_query->query('cat=5&showposts=3' . '&paged='.$paged);
    		while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    		<h2><a>" title="Read more"><?php the_title(); ?></a></h2>
    		<?php the_excerpt(); ?>
    
    		<?php endwhile; ?>
    
    		<?php wp_reset_postdata(); ?>
    
    	</article>
    
    <?php get_footer(); ?>

Reply

You must log in to post.

About this Topic