You could put this in a Page Template.
<?php
//show latest post with date
$args=array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'Latest of Post';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><?php the_time('m.d.y') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
I must be missing something.
I copy and paste the above code in my open div, and all that is displayed is the ‘script’ as if it were in a ‘p’ tag rather than code.
If I place it in a <script> tag, the code doesn’t render, but neither does the result.
Thanks. Appreciate the assistance as I am just starting to get into more advanced stuff with wp and the codex.
Please paste all the code from that page template that is displaying those posts into a pastebin such as wordpress.pastebin.ca, and report the link back here. Maybe someone can spot your problem. Thanks.
OK. placed it on wordpress.pastebin.ca…
http://wordpress.pastebin.ca/1760886
Thanks.