group posts by month/date ignore years

Need group posts from custom post type by post date. Example: Jan (all posts posted in januar for all years 2010,2011 ... 2015) 1 (all posts posted in 1 januar for all years 2010,2011 ... 2015) POST1 POST2 ... 2 (all posts posted in 1 januar for all years 2010,2011 ... 2015) POST1 POST2 ... Feb (all posts posted in januar for all years 2010,2011 ... 2015) 1 (all posts posted in 1 januar for all years 2010,2011 ... 2015) …
Category: Web

Change pubDate in rss feed in another format

In the default wordpress rss feed the element <pubDate> is <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> and gives a result of <pubDate>Tue, 12 May 2020 12:39:03 +0000</pubDate> how can i change this line to give a result of <pubDate>12/05/2020 12:39:03 +0000</pubDate> (d/m/Y) or <pubDate>12-05-2020 12:39:03 +0000</pubDate> (d-m-Y) but to be valid with RFC-822 ? I tried many variations <pubDate><?php echo mysql2date('r', get_the_time('Y-m-d H:i:s')); ?></pubDate> or <pubDate><?php echo get_post_time( 'd/m/Y …
Category: Web

How to update the 'modified_time' of a post ONLY when content is changed?

For some reasons I show the Last Modified information to my users in the blog. Recently I have to clear up my categories and tags, but these actions will result in the update of 'Last Modified' field of a post, which is not actually I desired. Content updates are what readers really concerned about, and not about meta information (like tags, categories, custom fields, descriptions, etc). So is there a way to update the 'Last Modified' field of a post …
Category: Web

Is there way to toggle the publish date display?

I am interested in changing our WP dashboard so that I can choose whether an individual Post will include the publish date or not. Is there a way to do it without a plug-in and insert code that maybe creates a checkmark or something like that in the Post dashboard that can toggle the publish date display? Thank you in advance!
Category: Web

Mini app that shows one unique quote each day. 56 rotating posts rotating for each themed weekday. It works, but I need your advice

Let's say I have 365 posts published in 2022. I have 56 posts for each weekday (each weekday has a different theme). Normally, if I were to publish them in order, the 1st Monday post would be published on January 3rd and the second Monday post would be published on January 10th. But I want to reuse these posts and for them to be correctly displayed each year, not just in 2022. So I published batches of posts by weekday. …
Topic: date Wordpress
Category: Web

Set a post expiration and delete a post when expirate

I'm trying to create a function that allows me to delete an article when the date of the day is equal or superior than a date filled in a custom ACF field. I wrote the function below that I placed in my single.php in order to test it. It works, except that you must be reading the article in question for this function to execute (pretty logical actually). What I want is that this function runs itself on all the …
Category: Web

XML export posts from one single day

How to export all posts from one single day. I've tried Tools > Export > Post. But problem is that there's only monthly backup, not date-wise as in "only 5th July 2015". How can I achieve this?
Category: Web

Removing old_slug and old_date from WordPress Database

I am trying to clean my database. In the wp_postmeta table I see thousands of _wp_old_slug rows. I am not concerned about these old links not being redirected. What are the pros and cons of removing them? See: https://www.farinspace.com/removing-wordpress-old-post-slug/ In the wp_postmeta table I see hundreds of _wp_old_date rows. I am not concerned about knowing when a post was originally written. I am only concerned about the most recent 'published on' date and want to continue displaying the most recent …
Category: Web

Include last post date in get_categories loop

I have a simple get_categories loop on a template page which works fine to display a list of categories within the parent category 52 (as shown below). I would like to also display the last post date with each category so it displays the date of the latest posts within the category. Is this possible: <?php $args = array('parent' => 52); $categories = get_categories( $args ); foreach($categories as $category) { echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" …
Category: Web

Divide WP_Query posts by date & post type

I have a WP_Query that divides 2 Posts types by date but the functionality is not there. Currently it outputs the dates and posts on the same level like.. -Date -Post -Post -Date -Post -Post What I would like is to wrap each date and its associated posts inside a div, as well as split the two post types for each date into two columns. Update I managed to split the posts up by date and wrap them in separate …
Category: Web

How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)

I have an ACF text field for a CPT that is holding a date in DD/MM/YYYY format (it's a text field and not a datepicker field as the data was imported from a CSV file). My Wordpress loop then sorts by this field in DESC order but of course as it stands this means it displays the entries for the 31st of the month first as the day is the first part of the string. Is there any way to …
Category: Web

How to add a sortable date column in an admin page?

I'm trying to add a date column to an admin table (to woocommerce order page, just to be specific, but this code is not plugin dependent). The code works for adding the column, but whenever I try to sort the column tapping the sorting triangle button on the order page it returns 'No record found'. Maybe there is a problem with date format in the function returning the date? The rest of the code is pretty standard // Adding a …
Category: Web

Is it possible to change X Hours Ago to date in WP Admin?

Is it possible to change "X Hours Ago" to date in WP Admin? Edit: This seems to work except for one thing. It says the date fine, but then it says " ago" so it shows "Feb 16, 2022 ago". Any advice? code function wpse_time_diff_mins( $since, $diff, $from, $to ) { return wp_date('M j, Y', $from); } add_filter( 'human_time_diff', 'wpse_time_diff_mins', 10, 4 ); code
Topic: date Wordpress
Category: Web

How to display custom post type ordered by a custom field date

I have a custom post type for a timeline activities. each post of them has a custom field type of DATE. field name :activity-date I'm using TYPES plugin for Custom Post Type and Custom Fields I would like to order these posts by the custom date field, I tried the following but didn't work. <?php $activities = new WP_Query( array( 'post_type' => 'timeline', 'posts_per_page' => -1, 'key' => 'activity-date', 'orderby' => 'meta_value_num', 'order' => 'ASC' )); ?>
Category: Web

How to display upcoming events by dat with Modern Events Calendar Lite

I'm using the plugin Modern Events Calendar Lite. This is a recent plugin, so actually no doc exist. So i'm looking a way to display my upcoming events on homepage. But i can not make it to work, because start is stored in a second table. So i have a wpquery that list custom posts "mec-events", this is ok. But i'm not able to JOIN info to second table to get start_date & to order posts on its value. I …
Category: Web

Display custom post types by date field

I have a custom post type that is simply titles with a date field. I want to display these posts in a list in order of this date field (not date posted). So simply: -- Sample date Event title 1 Event title 2 Sample date Event title 3 Event title 4 Event title 5 (etc) -- No extra info, that's literally all I want to display. I can't figure out how to go about this at all. I'm not great …
Category: Web

Display date and time into post edit comments section

My users need to see the date and time for each comment from the post edit page. Can anyone help me to display these metadata please? Edit: When editing a post (cpt in my case) you can see the comments related to it and create new comments or answers. But the comments metabox only display username, email, IP, and comments content. I would like the date and time to be displayed for each comments, as it is already enabled in …
Category: Web

If Post Published Date or Modified Date is 1 Year or Older, Display Notice on Post Page

I need a way to inform visitors if the post published date or modified date is older than 1 year and if so, display a message on the post page. I have added an code to my content-single.php file, but without the desired results in terms of checking against both published and updated time. Example: if (strtotime($post->post_date) < strtotime('-1 year')){ echo 'Old Post'; } else { echo 'Not Old Post'; } Any ideas as I'm in the dark here..
Category: Web

How to change post published date to today date with SQL

How to change already published post date and time to current date and time using SQL. I have a solution for the year but I don't know how to change the completion date to the current date and time. UPDATE wp_posts SET post_date = post_date + INTERVAL 1 YEAR WHERE YEAR(post_date) = 2020;
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.