Modifying posts based on category in TwentyTwentyTwo theme

I managed to solve my problem. So, the posts are using a single.html template file (in the TwenytTwentyTwo theme: /templates/single.html). I wanted to target a category class in the <body> element of the single.html. To make that happen, I had to modify the single.html file in my Child theme by adding the following code snippet … Read more

How to get post taxonomy url and name in wp_query

Please try this <div class=”post-category”> <?php // @ https://developer.wordpress.org/reference/functions/get_the_terms/ $terms = get_the_terms( get_the_ID(), ‘video-category’ ); if ( $terms && ! is_wp_error( $terms ) ){ $term_links = array(); foreach ( $terms as $term ) { $term_links[] = ‘<a href=”‘ . esc_attr( get_term_link( $term->slug, $taxonomy ) ) . ‘”>’ . __( $term->name ) . ‘</a>’; } $all_terms … Read more

wordpress category rewrite rule with pagination

I was able to solve it doing these rewrites in the following order. So I specified 3 category url in the beginning then 2 category url below that and in the and single category url /combine/brand/category1/category2/page/1-9/ add_rewrite_rule( ‘^combine/([^/]*)/([^/]*)/([^/]*)/page/([0-9]*)$/’,’index.php?category_name=$matches[1]+$matches[2]+$matches[3]&paged=$matches[4]’, ‘top’ ); /combine/brand/category1/page/1-9 add_rewrite_rule( ‘^combine/([^/]*)/([^/]*)/page/([0-9]*)$’,’index.php?category_name=$matches[1]+$matches[2]&paged=$matches[3]’, ‘top’ ); /combine/brand/category1/ add_rewrite_rule( ‘^combine/([^/]*)/?([^/]*)/([^/]*)/?’,’index.php?category_name=$matches[1]+$matches[2]+$matches[3]’, ‘top’ );