unit test data added many category to some posts.so, on archive page, the long category list seems bad because you know its long, ugly.
so, to solve this visual problem, I want to set offset to this category number.
How can I do it?
here is my archive page.I tried to add offset to the wp query but it doesnt work.
you can check the archive page with this link:
/category/edge-case-2/
( Edge Case: Many Categories )
archive.php:
<?php get_header(); ?>
<main role="main">
<?php get_template_part( 'breadcrumb' );?>
<section class="ulockd-service-details">
<div class="container">
<?php hekim_left_sidebar(); ?>
<?php hekim_col_sidebar(); ?>
<div class="row">
<?php
//To retrieve current category id dynamically
$current_cat = get_the_category();
$cat_ID = $current_cat[0]->cat_ID;
$loop = new WP_Query(array(
'offset' => 2, //Set your offset
'cat' => $cat_ID, //The category id
));
?>
<?php if ($loop->have_posts()): while ($loop->have_posts()) : $loop->the_post(); ?>
<?php
if ( $thumbnail_id = get_post_thumbnail_id() ) {
?>
<div class="col-md-12 ulockd-mrgn1210">
<div class="ulockd-project-sm-thumb">
<img class="img-responsive img-whp" style="width: 368px; max-height: 580px;" src="<?php the_post_thumbnail_url(array(1100, 550)); ?>">
</div>
</div>
<?php
}
?>
<div class="col-md-12 ulockd-mrgn1210">
<article class="ulockd-pd-content">
<div class="ulockd-bp-date">
<ul class="list-inline">
<?php
if ( class_exists( 'Redux' ) ) {
global $redux_demo;
if ($redux_demo['button-set-date-choose'] == 1)
{
?>
<li class="ulockd-bp-date-innner"><?php _e( 'On ', 'hekim' )?><a href="#"><span class="text-thm2"><?php the_time('j'); ?></span> / <?php the_time('F Y') ?></a></li>
<?php
}
else {
?>
<li class="ulockd-bp-date-innner"><?php _e( 'On ', 'hekim' )?><a href="#"><span class="text-thm2"><?php the_time(); ?></span></a></li>
<?php
}
}
else {
?>
<li class="ulockd-bp-date-innner"><?php _e( 'On ', 'hekim' )?><a href="#"><span class="text-thm2"><?php the_time(); ?></span></a></li>
<?php
}
?>
<li class="ulockd-bp-comment"><a href="#"><span class="flaticon-nurse-head text-thm1"></span> <?php the_author_posts_link(); ?></a></li>
<li class="ulockd-bp-comment"><a href="#"><span class="flaticon-chat text-thm1"></span> <?php if (comments_open( get_the_ID() ) ) comments_popup_link( __( 'Leave your thoughts', 'hekim' ), __( '1 Comment', 'hekim' ), __( '% Comments', 'hekim' )); ?></a></li>
<li class="ulockd-bp-comment"><a href="#"><span class="flaticon-black-check-box text-thm1"></span> <?php the_category(); ?></a></li>
</ul>
</div>
<h3><?php the_title(); ?> </h3>
<p class="project-dp-one"><?php the_excerpt(); //html5wp_excerpt('html5wp_index'); // Build your custom callback length in functions.php ?></p>
<a class="btn btn-lg ulockd-btn-thm2" href="<?php the_permalink(); ?>"><?php _e( ' Read More', 'hekim' )?></a>
</article>
</div>
<?php endwhile; ?>
<?php else: ?>
<article>
<h2><?php _e( 'Sorry, nothing to display.', 'hekim' )?></h2>
</article>
<?php endif; ?>
<?php get_template_part( 'pagination' ); ?>
</div></div><?php hekim_right_sidebar(); ?>
</div></section>
<?php get_footer(); ?>
</main>