Remove Archive | from Categories

In case you are referring to the title shown in the browser title bar: this could be achieved by coding, but the easiest way would probably be to use an option provided by the SEO plugin Yoast (in case you have that installed). In your admin go to “SEO > Titles & Metas > Post … Read more

List recent posts with link to first category

get_category_link() accept the category ID or object and you are passing the post ID. the_category() accept Separator as a first parameter to separate multiple categories and again you are passing post ID. You can use get_the_category to get all the categories and then display one of category information. Example:- $all_post_categories = get_the_category($recent[“ID”]); $category_obj = isset($all_post_categories[0]) … Read more

Getting the Most Recent Posts from Multiple Categories

I use the following for multiple post types, just replace foo and bar with your own post types: $args = array( ‘post_type’ => array( ‘foo’, ‘bar’ ), ‘orderby’ => ‘post_date’, // other parameters as needed ); $q = new WP_Query( $args ); if ($q->have_posts()) : while ($q->have_posts()) : $q->the_post(); // do stuff endwhile; endif;

wp_list_categories with category description

Extend the Walker_Category class We can extend the Walker_Category class to append the category description to each item. Here’s a demo example with an anonymous class (PHP 7+): $args = [ ‘walker’ => new class extends Walker_Category { public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { // … Read more