Hello Joy Nice to meet you,,,,,I made a news theme there created post grid by Isotop I make it dynamic, now when page load all categories posts show in active mode when click in specific category then show all posts under a category, I want to display one category posts after page load,how can I do this?? if u have idea help please
<div class="post-widget m-0 white-bg">
<div class="cate-tab-navs">
<div class="container">
<ul class="nav-justified">
<?php $categories = get_categories();
foreach ( $categories as $row){
echo '<li><a data-target="#'.$row->name.'" data-toggle="tab">'.$row->name.'</a></li>';
}
?>
</ul>
</div>
</div>
<div class="cate-tab-content theme-padding">
<div class="container">
<div class="tab-content">
<?php foreach($categories as $row) : ?>
<div class="tab-pane active fade in" id="<?php echo $row->name;?>">
<div class="row slider-post">
<?php
// list post display here
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category_name' => $row->name,
'posts_per_page' => 4
);
$my_result = new WP_Query($args);
if($my_result-> have_posts()){
while($my_result->have_posts()) : $my_result -> the_post();
?>
<div class="col-sm-3 col-xs-6">
<!-- post -->
<div class="post style-1">
<!-- post img -->
<div class="post-thumb">
<?php the_post_thumbnail('spc-pos-cat',array('class'=>'spc_img_class'));?>
<span class="post-badge"><?php the_category();?></span>
<div class="thumb-hover">
<div class="position-center-center">
<a href="<?php the_permalink();?>" class="fa fa-link"></a>
</div>
</div>
</div>
<!-- post img -->
<!-- post details -->
<div class="post-content">
<h4><a href="<?php the_permalink();?>"><?php the_title();?></a></h4>
<ul class="post-meta m-0">
<li><i class="icon-user"></i><?php the_author();?></li>
<li><i class="icon-clock"></i><?php the_time();?></li>
</ul>
</div>
<!-- post details -->
</div>
<!-- post -->
</div>
<?php endwhile;};?>
<?php wp_reset_query();?>
</div>
</div>
<?php endforeach;?>
</div>
</div>
</div>
</div>
-
This reply was modified 3 years, 5 months ago by Rihan Habib.