I am trying to get the most recent and show it using the native function (e.g. get_the_title()), do NOT want to use $post['post_title'] but when I do this I'm an error.
global $post;
$featured_post = wp_get_recent_posts(array( 'numberposts'=>'1', 'post_type' => 'post' ));
foreach ($featured_post as $post) {
setup_postdata($post);
echo get_the_title();
}
This is the error I get:
Notice: Trying to get property of non-object in /.../wp-includes/query.php on line 4601
Notice: Trying to get property of non-object in /.../wp-includes/query.php on line 4603
Notice: Trying to get property of non-object in /.../wp-includes/query.php on line 4605
Notice: Trying to get property of non-object in /.../wp-includes/query.php on line 4606
Notice: Trying to get property of non-object in /.../wp-includes/query.php on line 4617
Notice: Trying to get property of non-object in /.../wp-includes/query.php on line 4625
Notice: Trying to get property of non-object in /.../wp-includes/query.php on line 4642
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire