Skip to content

Instantly share code, notes, and snippets.

Created July 9, 2015 16:58
Show Gist options
  • Save anonymous/d76a0230bab258124e9c to your computer and use it in GitHub Desktop.
Save anonymous/d76a0230bab258124e9c to your computer and use it in GitHub Desktop.
add_shortcode( 'newsPost_block', 'newsPost_block_func');
global $post;
function newsPost_block_func() {
$html = '';
$args = array(
'posts_per_page' => 1
);
$query = new WP_Query($args);
var_dump($query->have_posts());
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post;
$html .= the_content();
}
}
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment