Previous and next post links within the same category The default post navigation links to the previous and next post by date, across all categories. On a magazine with very different sections, a reader of a recipe gets a link to a football report. get_adjacent_post() and the navigation template tags accept “stay in the same…
Custom comment markup with a wp_list_comments() callback wp_list_comments() prints the comments of a post with WordPress’ default markup: an <li> per comment with the avatar, author, date and text in a fixed structure. A design with comment cards, a “3 days ago” date or a different order of elements needs its own markup. The callback…
date_query in WP_Query: filter posts by date range, weekday and modified date WP_Query has a date_query parameter that goes far beyond the simple year and monthnum arguments. It takes a list of date conditions joined with AND or OR, can compare single parts of a date (year, month, week, day, hour) or ranges (after and…
Group your blocks in their own inserter category A plugin with many blocks should not scatter them over “Text”, “Media” and “Design”. Its own category in the inserter keeps them together and makes them easy to find. WordPress 5.8 renamed the filter for it to block_categories_all; the old block_categories still works but is deprecated.