post category wise call

PHOTO EMBED

Tue Nov 22 2022 21:27:22 GMT+0000 (Coordinated Universal Time)

Saved by @waqaskhan #function.php #js

<?php
    /**
     Template Name: Blog
     */
    
    get_header(); ?>
<blog>
<?php 

if( get_field('page_builder') ){
        $page_builder = get_field('page_builder');
        //echo print_r( $page_builder);

        foreach ($page_builder as $key => $section) {
            include('inc/inc-'.$section['acf_fc_layout'].'.php');
        }
    } 

?>


<div class="blog-section with-bg">
    <div class="container">
        <div class="row">
            <div class="col-md-7">
                <div id="blog_loop" class="row">
                    <?php
                        // WP_Query arguments
                        $args = array(
                          'post_type'            => 'post',
                          'post_status'          => 'publish',
                          'order'                => 'DESC',
                          'posts_per_page'     =>  -1,
                        );
                          $po = new WP_Query($args);
                         ?>
                    <?php if ($po->have_posts() ): ?>
                    <?php while ( $po->have_posts() ) : ?>
                    <?php $po->the_post(); ?>  
                    <div class="col-md-6 col-sm-12 item_loop">
                        <div class="blog-item">
                            <div class="thumbnail-blog">
                                <a href="<?php the_permalink(); ?>" >
                                    <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
                                    <div class="image" style="background-image: url('<?php echo $thumb['0'];?>')"></div>
                                </a>
                            </div>
                            <div class="blog-content">
                                <h3 class="title"><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
                                <div class="except">
                                    <?php $content=get_the_content(); echo substr($content,0, 250)." ..."; ?>
                                </div>
                                <div class="meta"> 
                                  <div class="asign-author"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/icon-author.png" width="19" height="19" alt=""> <?php the_author(); ?> </div> 
                                  <div class="entry-date"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/icon-calander.png" width="18" height="18" alt=""> <?php echo get_the_date(); ?></div>
                                </div>
                            </div>
                        </div>
                    </div> 
                    <?php endwhile; ?>
                    <?php  endif; ?>
                </div>
            </div> <!-- end col-md-7 -->
            <div class="col-md-4">
               <?php get_sidebar(); ?>
                <!-- sidebar -->
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="stl-head text-center">
                    <div class="sub-head">latest blogs</div>
                    <h3>Trending <span class="multicol">Stories</span></h3>
                </div>
                <div id="blog_trend" class="row">
                    <?php
                        // WP_Query arguments
                        $args = array(
                          'post_type'            => 'post',
                          'post_status'          => 'publish',
                          'order'                => 'DESC',
                          'posts_per_page'     =>  -1,
                          'tax_query'        => array(
                              array(
                                  'taxonomy' => 'category',
                                  'field'    => 'slug',
                                  'terms'    => 'trending-stories',
                              ),
                          ),
                        );
                          $po = new WP_Query($args);
                         ?>
                    <?php if ($po->have_posts() ): ?>
                    <?php while ( $po->have_posts() ) : ?>
                    <?php $po->the_post(); ?>  
                        <div class="col-md-4 col-sm-12 trending">
                            <div class="blog-item">
                                <div class="thumbnail-blog">
                                    <a href="<?php the_permalink(); ?>" >
                                        <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
                                        <div class="image" style="background-image: url('<?php echo $thumb['0'];?>')"></div>
                                    </a>
                                </div>
                                <div class="blog-content">
                                    <h3 class="title"><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
                                    <div class="except">
                                        <?php $content=get_the_content(); echo substr($content,0, 250)." ..."; ?>
                                    </div>
                                    <div class="meta"> 
                                      <div class="asign-author"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/icon-author.png" width="19" height="19" alt=""> <?php the_author(); ?> </div> 
                                      <div class="entry-date"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/icon-calander.png" width="18" height="18" alt=""> <?php echo get_the_date(); ?></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endwhile; ?>
                    <?php  endif; ?> 
                </div>
            </div>
        </div>
    </div>
</div>
</blog>
</section>
<?php get_footer(); ?>
content_copyCOPY

post in taxquery