Get Post Data From Simple Post custom shortcode

<div class="container" id="artical-block">

    <h2 id="all-artical-head">All Articles</h2>

    <?php

    global $post;

    $args = array( 'numberposts' => -1, 'category' => 31 );

    $posts = get_posts( $args );

    foreach( $posts as $post ): setup_postdata($post);

    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') );

?>      

<div class=" col-md-12 artical-block">

      <div class="row">

        <div class="col-sm-3 col-md-3"><img src="<?php echo $url ?>" width="" height="" alt="image" class="img-responsive"></div>

        <div class="col-sm-9 col-md-9">

          <h4><?php the_title(); ?></h4>

          <p class="date-timing">By <?php echo get_the_author(); ?> | Date: <?php echo get_the_date(); ?> | Time: <?php echo get_the_time(); ?></p>

         <p class="date-timing"><?php the_content(); ?></p>

          <a href="<?php the_permalink(); ?>">Read More</a> </div>

      </div>

    </div>

    <?php

    endforeach;

?>

</div>

Comments

Popular posts from this blog

Top 20 Beautiful Pen For Writing

Fatal error: Maximum execution time of 300 seconds exceeded in C:\xampp\phpMyAdmin\libraries\classes\Dbi\DbiMysqli.php on line 199