Question

Alright y'all. I want to dynamically display the information of the 2 most current posts to the screen. So far I have only been able to get results by hard coding the ID into the query. Is there a way to retrieve this data dynamically?

query_posts('showposts=2'); 

 while (have_posts()) : the_post(); ?>

<?php $x = get_the_ID(); 
echo $x;
$postStuff = $wpdb->get_row('select * from wp_posts where ID = "$x", ARRAY_A);
print_r($postStuff); ?>

<?php endwhile;?>

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top