Post Loop

PHOTO EMBED

Wed Apr 19 2023 10:53:52 GMT+0000 (Coordinated Universal Time)

Saved by @hamzahanif192

function post_loop()
{
	$arg = array(
		'post_type' => 'post',
		'posts_per_page' => -1,
		);
        $postPost = new WP_Query($arg);
	?>
	<div id="mainPost" class="row">
	<?php if ($postPost->have_posts()) : ?>
			<?php while ($postPost->have_posts()) : ?>
			<?php $postPost->the_post(); 
				$content= get_the_content();
			?>
			<div class="col-md-6">
				<div class="singlePost">
					<?php the_post_thumbnail( 'full', array( 'class' => 'postImg' ) ); ?>
					<div class="contentArea">
						<h2><?php the_title(); ?></h2>
						<p><?php echo substr($content, 0, 180); ?>
					</div>	
				</div>
			</div>
			<?php endwhile; ?>
            <?php endif; ?>
</div>
<?php
	wp_reset_postdata();

}
add_shortcode('mainPost', 'post_loop');
content_copyCOPY