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

Questions tagged [date]

The tag has no usage guidance.

19
votes
5answers
22k views

the_date() not working

I am using wordpress 3.2 and I did a query post like this: <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?> Then I try to echo out the date of this post I queried like ...
0
votes
1answer
12 views

Update post meta date always store 1970-01-07

I want to update the post meta "job_expires" to the current "job_expires" meta data + 1 week but with this code always store 1970-01-07 as date. $lejar_datum = get_post_meta($job_id , '_job_expires', ...
0
votes
0answers
34 views

Display post date with the date archive link for custom post types

i have a custom post type and every single post it displays post date like 05 Jun 2019. i show this date with this code : <a href="<?php echo get_day_link(get_post_time('Y'), get_post_time('m'),...
0
votes
1answer
21 views

Display time difference (6 hours ago) in a Soliloquy caption

Thanks for viewing. I am using a soliloquy plugin addon to display post date in slide captions. I want to change the post date to human difference or 'hours ago' format. I'm converting get_the_date ...
0
votes
1answer
36 views

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

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, ...
9
votes
3answers
48k views

How to get posts published between a date and today?

Is it a way to get posts published between a date and today with query_posts() ? Example : All posts published since 2012-04-01 Thanks EDIT : How to add the filter date on this Query Posts ? ...
-1
votes
1answer
690 views

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?
1
vote
1answer
2k views

Orderby ASC changes to DESC in WP_Query

I am trying to get posts in Ascending order using WP_Query, $args = array( 'date_query' => array( array( 'year' => $ppy, 'orderby' => 'post_date', ...
0
votes
1answer
718 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
1answer
23 views

Filtering posts by archive showing all years

I have set up a WP_Query within my archive.php page. This is so I can do different things such as pagination etc. I also have two drop down filters categories and archive (yearly). When selecting a ...
0
votes
2answers
710 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
24 views

How to add publish date in the title

I learned a solution from https://stackoverflow.com/questions/36671203/wordpress-publish-date-shortcode Although it can show the publish in the title, in the source code, it still shows the shortcode ...
0
votes
2answers
671 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
0answers
18 views

Meta query: How do I return posts within a date period from a given month?

I have posts with a meta start_date and a meta end_date, stored in timestamp format (I can change the format if necessary) I would like to return all posts that have a date in that month by giving a ...
1
vote
0answers
20 views

WPForm, how to set date to tomorrow

<script type="text/javascript"> window.wpforms_datepicker = { disableMobile: true, // Don't allow users to pick past dates minDate: new Date(), } </script> &...
0
votes
1answer
19 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
730 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
98 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
27 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
20 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
10 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
59 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
17 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
152 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
27 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
22 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
543 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
45 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
25 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....
1
vote
1answer
237 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
53 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
64 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
23 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
34 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
42 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
21 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
59 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
35k 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
158 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( "#...