Whatsapp Sticky Button
December 27, 2021Adding Image Styling Using Clip-path Attribute
January 15, 2022
This function is used to change a custom post taxanomy order date wise in ascending or descending order
Add this function in your taxonomy-xyz.php file
$term_slug = get_query_var( 'term' );
$taxonomyName = get_query_var( 'taxonomy' );
$current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
$args = array(
'post_type' => 'add your post type',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query'=>array(
array(
'taxonomy'=>$taxonomyName,
'field'=>$term_slug,
'terms'=> $current_term,
)
)
);
<?php $query = new WP_Query($args); while ($query->have_posts()) : $query->the_post();?>
//stuff here
<?php endwhile; ?><?php wp_reset_query(); ?>
<?php
//$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$term_slug = get_query_var( 'term' );
$taxonomyName = get_query_var( 'taxonomy' );
$current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
$args = array(
'post_type' => 'bible',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'ASC',
'tax_query'=>array(
array(
'taxonomy'=>$taxonomyName,
'field'=>$term_slug,
'terms'=> $current_term,
)
)
);
$query = new WP_Query($args);
?>
<h3 class="archive-title"><?php //echo apply_filters( 'the_title', $term->name ); ?> </h3>
<ul>
<?php
$query = new WP_Query($args);
while ($query->have_posts()) : $query->the_post();
// if ( $query->have_posts() ) :
?>
<li class="animal-listing column one-second" id="post-<?php the_ID(); ?>">
<a style="text-decoration:none;" href="<?php the_permalink(); ?>">
<h5 style="color:#432775"><?php the_title(); ?> </h5>
<p> <?php the_excerpt(); ?></p>
</a>
</li>
<?php endwhile; ?>
<?php wp_reset_query();?>