How to set post date in post_type so that it’s same as latest post in category

[ad_1]

I’ve post_type referred to as ‘collection’ and posts with sharing category as attachment. The downside is after I create listing utilizing post_type by date, the date follows post_type post date and not latest ‘post’. How can I change that mechanically?

<?php $paged = get_query_var("paged") ? get_query_var("paged") : 1; $chapter = new WP_Query(array("post_type" => "series", "posts_per_page" => 12, "orderby" => "date", "paged" => $paged)); if ($chapter->have_posts()) { whereas ($chapter->have_posts()) { $chapter->the_post(); get_template_part('template-parts/content', 'index'); } } ?>

From template half

<div class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div>
<ul class="chapter">
<?php $title = basename(get_permalink()); $chapter = new WP_Query(array("showposts" => 1, "post_type" => "post", "tax_query" => array(array( 'taxonomy' => 'category', 'subject' => 'slug', 'phrases' => $title,),), "no_found_rows" => true, "update_post_term_cache" => false, "update_post_meta_cache" => false, "cache_results" => false)); if($chapter->have_posts()){ whereas ($chapter->have_posts()) { $chapter->the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a><span class="date"><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?> </span>

[ad_2]
Source link

Leave a Reply