$posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "posts WHERE post_type='post' AND post_status='publish' LIMIT 5" );
$posts = $wpdb->get_results( 'SELECT * FROM '. $wpdb->prefix.'posts LIMIT 5' );
$posts = $wpdb->get_results( 'SELECT * FROM '. $wpdb->prefix.'posts WHERE post_type='post' AND post_status='publish' LIMIT 5' );
echo get_permalink( $post );
echo 'http://your_domain.com/news/' . $post->post_name;
foreach( $posts as $post ) {
echo $post->post_title;
}
2016/07/18 07:26:22 [error] 25789#0: *1666167 FastCGI sent in stderr: "PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/*****/httpdocs/content/themes/*****/content-single.php on line 31" while reading upstream, client: 5.9.123.116, server: *****, request: "GET /events/secure-it-world/ HTTP/1.0", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "*****"