How to make active mode first category items after page load
-
I made an news theme,there I used Isotop plugin for post grid. When I load page all catagories posts show in active mode, then if I click categor buton shows specific category posts, I want to active mode one category posts in active mode after page load,Below I write my code.If anyone there please help
I made an news theme,there I used Isotop plugin for post grid. When I load page all catagories posts show in active mode, then if I click categor buton shows specific category posts, I want to active mode one category posts in active mode after page load,Below I write my code.If anyone there please help
<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>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 $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>" class="fa fa-link"></a> </div> </div> </div> <!-- post img --> <!-- post details --> <div class="post-content"> <h4><a>"><?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>
<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>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 $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>" class="fa fa-link"></a> </div> </div> </div> <!-- post img --> <!-- post details --> <div class="post-content"> <h4><a>"><?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>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to make active mode first category items after page load’ is closed to new replies.