change read more text in archive page depending on post category

With the online php generator I’ve created this code snippet. $post_categories = get_the_category($post->ID); $parent_category_name=””; if (!empty($post_categories)) { $parent_category = $post_categories[0]->parent ? get_category($post_categories[0]->parent) : $post_categories[0]; $parent_category_name = $parent_category->name; } if ($parent_category_name === ‘Apple’ || $parent_category_name === ‘Strawberry’) { echo “<span>Apples &amp; Strawberries</span>”; } else { echo “<span>Fruits</span>”; } It really works fine for me.

If all posts have exactly the same publication date/time, to the second, what order are they listed in the main query?

In short, it’s implementation-dependant. See: https://dba.stackexchange.com/questions/6051/what-is-the-default-order-of-records-for-a-select-statement-in-mysql https://stackoverflow.com/questions/60293373/how-order-by-ordered-if-they-are-same-value The MySQL 8 ref manual here also stated that: On character type columns, sorting—like all other comparison operations—is normally performed in a case-insensitive fashion. This means that the order is undefined for columns that are identical except for their case. You can force a case-sensitive sort for a … Read more

List archive year – post by post

Here is a strip down of something similar I’ve done a while ago. Here is what the code basically does is: First, it retrieves the date of the first post on the block. Secondly, the current date is retrieved. These two values are fed into a range() function to get all years in between A … Read more

WP Archive & Category Pages not filtering

From the codex for get_posts() The category parameter needs to be the ID of the category, and not the category name. So you should either use category_name parameter with name or you could pass the ID to category. <?php $term_name = get_queried_object()->name; $args = array ( ‘category_name’ => $term_name, ‘posts_per_page’ => 5); $myposts = get_posts( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)