Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [date]

The tag has no usage guidance.

0
votes
0answers
2 views

Primary navigation menu with timed items from custom post type

I have created a site (livermorevalleyopera.com) for a client. I made a custom post type for events. In the primary navigation I have a top level menu item "Season Events & Tickets" and the ...
0
votes
1answer
720 views

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 ...
0
votes
2answers
55 views

Way to display “Yesterday”, “Today”

I currently use the following code below in my loop to display dates for groups of posts. Works great, was just wondering if it's possible to change the day from php code 'l'(Sunday-Saturday) to Today ...
0
votes
0answers
21 views

PHP 7.2 Upgrade Issue: Published Date Showing As Current Date on Front-End of Posts

So we recently noticed that the post date on our posts is showing up as the current date. For example here: https://www.chrisapappas.com/2019/02/11/grammys-2019-best-dressed/. All our posts are ...
1
vote
1answer
15 views

Show post updated date instead of published

I need simple solution to show updated date instead of published without adding any functions. I have read few articles, but they are bit complex using "dirty" code. This is my current code is it ...
0
votes
1answer
9 views

Tumblr imported blog showing wrong date

I imported my Tumblr blog to Wp but all my blog are showing the preceding date as the date of publishing. I even changed the timezone of my wp account to my location before importing but the problem ...
1
vote
1answer
43 views

Remove “at” string from wordpress comment date

I'm using the following code to format the author's comment date and remove the time: function my_change_comment_date_format( $date, $date_format, $comment ) { return date( 'd M Y', strtotime( $...
1
vote
2answers
13 views

Same date is repeating on my custom 'Most Recent Posts' on sidebar

If you look at the 'most recent posts' on my sidebar for my posts page, you can see that the 'date' is repeating. The code and page is below. Any help would be appreciated. Thanks! https://...
0
votes
0answers
10 views

Wordpress contact form 7 compare dates

I am using a contact form 7 plugin. I have two dates fields - date-from and date-to. When I am clicking on date-to,i must calculate the difference between date-from and date-to with jquery function. ...
0
votes
3answers
12k views

Order by custom field date with ASC order

I've found several similar question but none of them explains why the below is giving me nothing with ASC order. It works with DESC. Basically it's a query that should list posts where the custom ...
0
votes
1answer
149 views

ACF Date Form in Custom Admin Field

I have this function code, that brings in a ACF date picker data, and adds it to the columns view. It;s raw format is YYYYMMDD My next step is to change the format of the date to, Day Month Year so ...
0
votes
0answers
24 views

Problem with my loops

I am French. Sorry if i make mistakes. I have two problems. The first, I have a page that shows all paying activities sort by date. The 'posts_per_page' does not work When I put 10, it shows 8 ...
0
votes
1answer
22 views

Get system timestamp in wordpress

My system timezone is UTC+1, MySQL is using this timezone and it's ok. Now I want to get the same timestamps in WordPress. As you know, WordPress modifies the current timezone so time() returns UTC-...
1
vote
2answers
15 views

Print last modified date only on posts

I'm printing the last modified date via functions.php with the following code function wpb_last_updated_date( $content ) { $u_time = get_the_time('U'); $u_modified_time = ...
0
votes
1answer
533 views

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 ...
-1
votes
1answer
28 views

remove author and date from all posts [closed]

I've tried including some code in style.css of my theme, but it didn't work. Ex: body.blog .posted-on, body.blog .post-author, body.blog .post-comments, body.blog .entry-taxonomy { display: none; }...
0
votes
0answers
28 views

Convert number to date format within an array

I have a custom field of deal_date that I need to work into an array. When using directly on a template I can just set the output format directly in the ACF UI. However I obviously cant use get_field ...
0
votes
1answer
16 views

Display Updated Date Instead of Published Date

Both published and updated date are showing on the post page. How can I replace the published date if the last date is updated? The code is here: Published on <a class="entry-date" href="<?php ...
4
votes
4answers
9k views

How to get post creation date?

I suppose getting the first revision of a particular post and get the date, right ? How to do that?
1
vote
1answer
9 views

Set the publication date independent of the scheduled publication date

I want to write a post today (2019-01-15) I want to schedule the publication for the future (2020-09-03) I want the published date to reflect when it was originally written - so it appears as example....
0
votes
1answer
687 views

Display Year and Month from custom field + Age Calculator

I have a custom field "DOB" on my custom post type which is in [Ymd] format. I want to compare that date of birth to current time and want to show "You are # years # months." I am able to calculate ...
0
votes
2answers
678 views

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 ...
0
votes
2answers
648 views

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 ...
2
votes
2answers
1k views

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 ...
1
vote
1answer
126 views

WP_Query meta_query >= date

I have been trying for hours, I don't get my query to work: display only posts (from custom post type) with a field (Advanced Custom Fields date picker) value that is more than today. echo date('d-m-...
0
votes
0answers
47 views

How to sort wordpress posts by distance and date

I want to sort wordpress posts by user's distance from posts location and by date by using some calculation..Here is the formula. 2*log(distance) - log(time in seconds) I saved post's latitude and ...
0
votes
1answer
32 views

How to update all posts at once?

Like "after host change, we update our permalink"
0
votes
1answer
9 views

Can't add to time? [closed]

What's the best way to add to time()? For example: time() + 5 will return 5, not the current unix timestamp with 5 added to it. Any ideas? Thanks
0
votes
0answers
18 views

Timezone for Plugin

I'm using these two lines: $expires = strtotime( $_POST['expire_date']); if($expires < time()) to test the time in the name=expire_date form against GMT time. But no matter what I do my expire ...
0
votes
2answers
28 views

Conditional: IF post creation date is in the first half OR last half of the year [closed]

I'm trying to find a way how to have a simple conditional whereby I can echo something depending on whether the post date is in the first half or last half of the post date year.
0
votes
1answer
22 views

How to get Unix Local Time?

I have a given time and I'd like to confirm that is AFTER the current time. $expires_epoch = strtotime($_POST['expiry']); if($expires_epoch < current_time('mysql')){ ...do stuff... This snippet ...
0
votes
0answers
21 views

Wpforms snippet condition date+7

I want to limit the input in a datefield to (minimum) today+7. I found the snippet below, but i don't know how to customize it. Anyone that can help? (Sunday may be available) /** * Limit the dates ...
0
votes
1answer
38 views

How do you update post date (year only) in a separate custom field?

I would like to update all my posts with a custom field that stores the year the post was published. The "year" value will obviously be retrieved from the post's date meta data. I will then use the ...
1
vote
1answer
17 views

Adding number to date not working [closed]

I am adding number stored in custom user meta data to current date. Here is my code $addeddays = get_user_meta($this->order->user_id, 'xxx', true); $timeBase = date('j.n.Y'); echo date('j.n.Y', ...
0
votes
0answers
55 views

Sort posts on custom field AND after that sort on date?

I'm having trouble to understand customizing the new WP_query. I've found the script below, partly, here in order to get the sticky posts. I've further edited it in order to: first get the (sticky) ...
8
votes
4answers
34k views

How to get the post publish date outside the loop?

I need to pull out the post publish date in order to make the post post auto expire. The thing is I can't get the right publish date. Here is my code: global $wpdb; $post_ids = $wpdb->...
0
votes
1answer
133 views

How do i search post by jquery datepicker?

I'm working on the WordPress website I have my own search filter page, where I added the jquery datepicker, now I want to search post by datepicker? Html Code script> $(function() { jQuery( "#...
1
vote
2answers
56 views

Set meta field to publish date + 2 weeks

I have a meta field called postexpiry, and I want to set the value to the publish date, + 2 weeks. So if today were October 3rd, I want the field to be set to October 17th. I was thinking about ...
6
votes
3answers
573 views

Why my uploaded picture was loaded into /uploads/2015/02 not /uploads/2016/01?

Today is 2016-01-01 in my console. date Fri Jan 1 14:24:04 CST 2016 Now I write an article attached a photo which is taken today and publish it today. I found that the URL of the photo was ...
1
vote
3answers
2k views

Comparing dates in custom field

I have a function which should return the future event date: function get_upcoming_exercises( $limit = -1 ) { $args = array( 'post_type' => 'px_event', 'posts_per_page' =&...
-1
votes
1answer
29 views

How to randomize published date for WordPress custom post type

I have tried the following answer to randomize post published date: Update existing post dates to random dates It worked but I need to randomize custom post type. How do I do that? Example: post_type=...
1
vote
0answers
58 views

How to show recent and upcoming birthdays using meta_query

I have a date of birth user field, I am trying to show recent (past 7 days) and upcoming (next 7 days) birthdays. I have the below but it is not working because the years in the date of births are ...
2
votes
1answer
419 views

Use meta_query to display events by date in custom field

I'm working on a template for a specific category archive of the custom post type event. I need to make a query that shows future and ongoing events, ordering by a date in custom field. $termName = ...
0
votes
1answer
23 views

Grouping posts by date

I am trying to group my posts on the index page by date. For example: Date 1 Post 1 Post 2 Post 3 Date 2 Post 1Post 2 Post 3 For some reason, I keep getting the posts under each date. Here is my ...
4
votes
3answers
5k views

Get list of years when posts have been published

I want to create a list of posts from a Custom Post Type and add some filters the user can click to filter the list. I added filters for all the categories by using the get_terms() function. Now I ...
0
votes
1answer
2k views

How to remove Date from Meta Description on SERP?

I noticed on a few recent projects the Date is displaying in the Meta Description for all Custom Post Types and Taxonomies in WordPress. I was always under the impression the Date would usually show ...
0
votes
2answers
361 views

Human Time Diff, change mins to minutes

On my WordPress site, I am using the human time difference for the post date. If you have a post that was posted 59 minutes ago or under it appears as posted 1 min ago, 5 mins ago, or posted 35 mins ...
0
votes
1answer
664 views

Add Date and Author to Posts

I need to add the date and author to blog posts. The line needs to read like this example: Posted on January 20, 2018 by Name Clicking on the date will take you to a page with all posts published on ...
2
votes
2answers
776 views

Custom Post Types - How to include custom fields

I'm fairly new to wordpress and the content management system. I've been following a couple of tutorials to get started. I've been searching for specifically how to include a date picker in the add ...
1
vote
0answers
36 views

Make WordPress use timezone for email Date header

My WordPress installations send emails with the Date header specified in UTC: Date: Wed, 18 Jul 2018 15:18:50 +0000 I would prefer that the mail be sent with dates encoded in localtime, which is ...