Skip to content

Instantly share code, notes, and snippets.

@rubel306
Last active May 17, 2018 11:38
Show Gist options
  • Save rubel306/cbbc10dad597de0afdea80188a9a3e47 to your computer and use it in GitHub Desktop.
Save rubel306/cbbc10dad597de0afdea80188a9a3e47 to your computer and use it in GitHub Desktop.
<?php
function post_shortcode($atts, $content= null ){
extract(shortcode_atts(array(
'post_type' => "post",
'post_per_page' => 10
), $atts));
$get_post = new WP_Query(array(
'post_type' => 'page',
'post_per_page' => 5
)); ?>
<div class="content-wrap" style="background-color:#2E3539; padding: 80px 0; color: #ddd;">
<div class="container">
<div class="row">
<?php while($get_post->have_posts()): $get_post->the_post(); ?>
<div class="col-lg-6">
<div class="post-content" style="padding:80px 0px;">
<h2><?php the_title(); ?></h2>
<p><?php the_content(); ?></p>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
<?php
}
add_shortcode('post_content', 'post_shortcode');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment