<?php
/*
Template Name: Ron's WordPress Answers Template
*/
include_once('header.php');
$args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',//you have to use the category id # here not the name of the cat
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true );
$posts = get_posts( $args );
global $post;
foreach( $posts as $post ){
setup_postdata($post);
?>
<div class="post">
<p><a href="https://wordpress.stackexchange.com/questions/107227/<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></p>
<div class="meta">
By <?php the_author() ?>
</div>
<div class="storycontent">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}else{
}
?>
<?php the_content(); ?>
</div>
</div>
<?php
}
include_once('footer.php'); ?>
the_post_thumbnail(‘thumbnail’); // Thumbnail (default 150px x
150px max) the_post_thumbnail(‘medium’); // Medium resolution
(default 300px x 300px max) the_post_thumbnail(‘large’); //
Large resolution (default 640px x 640px max)
the_post_thumbnail(‘full’); // Full resolution (original
size uploaded)
I like to use ccs like this to make sure the images display “nicely”.
.storycontent img{
max-width: 100%;
height: auto;
}