Questions tagged [date]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
1k views

Header: Include Date Published and Date Modified

I'm trying to put the Date Published and Date Modified into the meta tags of the head of the header.php page - so far no luck. This is what I currently have: <meta name="date" content="<?php ...
2
votes
2answers
1k views

Display date only once for a each set of posts relating to that date

The following loop works great for me in getting posts with a given date with the use of the_time(...): <?php $myPost = new WP_Query( array( 'posts_per_page' => '50', 'orderby' =>...
0
votes
1answer
743 views

Using system date format

I have WordPress theme and I use get_the_date function to display post data : <?php echo get_the_date( 'M-d-y' ); ?> But it seems it will be better to use get_option( 'date_format' ). How can ...
0
votes
1answer
72 views

Comparing Dates within plugin using PHP If statement

This is really simple, but I can't seem to make it work. I want the Due Date text to be red if the current date is past due. I want it to be green if it is still not due yet. Also, I set the due date ...
1
vote
1answer
5k 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', ...
1
vote
2answers
51 views

I don't arrive to do order_by title when i have a conditionnal year in a request

I have a problem with this request with get_posts,when I want to order by title with year, order by doesn't work but when I do it without year, the request works. $args = array( '...
0
votes
1answer
90 views

Sort / display recent posts by publish date

I recently renovated some sites and made many small (usually typos) corrections to several posts. That of course changed the last update date, so that now, if I display recent posts in a widget, they ...
1
vote
1answer
242 views

Update post meta value as date difference between two fields

I have this code which is displaying the difference in days between two custom fields <div class="distance"> <?php $date1 = get_field( 'date_start', false, false ); $date1 = new ...
0
votes
2answers
850 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
2answers
107 views

Shortcode is not returned correctly

I've created a shortcode that should be showing an image depending on the day of the week. function custom_shortcode() { return '<img src="/wp-content/themes/coworker/images/daily-...
0
votes
1answer
120 views

display future posts in date page

hey im trying to display future posts in date page but date page redirect to 404 page when it is future date so i used this function function dg_override_404() { global $wp_query, $post; if(...
2
votes
1answer
273 views

How can I hide posts that are over 2 years old

I want to apply a rule to my site that filters out all blog posts that are over 2 years old. I see some solutions that involve manually putting posts into a category and hiding the category but I ...
0
votes
1answer
315 views

How to display Date and Time in Tamil Language?

Am working in a Tamil blog site.There I want to display date in Tamil language.(ie) செவ்வாய்க்கிழமை, மே 23, 2017 .I need to display like this in wordpress site.But I dont want to change all.Only the ...
0
votes
1answer
1k views

Return date in French

$current_post['date'] = get_the_date( $smof_data['blog-date_format'] ); echo $current_post['date']; I would like to display the date in french. How can I do that using de code above?
0
votes
1answer
361 views

Get posts by birthday

I am developing a blog website and it is a biography directory, how can i get posts for specific birth date and can fetch post for today's birth date. for example:on the date 17 may want to Show post ...
1
vote
1answer
1k views

pre_get_posts query between 2 dates (date stored in custom post meta)

I have a custom post type with posts which have a custom field of date. On the posts list (edit.php) I want to be able to filter posts between 2 dates based on the custom post meta date (not post ...
0
votes
2answers
70 views

how to show date of latest post in wordpress site?

i want to get the latest date of post in the homepage of my site. in this code : the_modified_date('d F Y'); date is different in different pages (For example page 1,2,...). i want to show just the ...
3
votes
2answers
435 views

Keeping post_date same as the pending post_date on privately publishing the post

I'm saving my CPT in private status. So the transition would be from pending to private. Thing is, when the post was first submitted and is pending there's a date of that submission on the post_date ...
0
votes
1answer
1k views

Meta Query Based on Month Range

I'd like to sort events into 4 lists based on seasons (spring, summer, fall, winter). If Spring is March 20th through June 20th, how can I loop through posts where the custom meta field (which ...
0
votes
1answer
1k views

Update existing post dates to random dates

I want to change the date of publication of my already published posts to random dates within the range starting from 2015 till today. How to do this in WordPress using CODE.
2
votes
1answer
151 views

Page Revision date displaying on google search

This must likely is a noob question, but I'm trying to remove the revision date that is showing up on my pages on a google search. I'm unable to find a answer to this on google, as all answers are ...
6
votes
5answers
3k views

How to handle optional end date in compare clause in meta_query

I have a custom post type event in WordPress, and I need to query upcoming event posts comparing $current_date. Query conditions are : start_date is a valid date always end_date can be a valid date ...
0
votes
1answer
70 views

Modify this line to give alternate format date?

Can this line: $message = str_replace( '[post_date]', $post->post_date, $message ); be modified so the date displayed for the [post_date] shortcode is formatted as Saturday, 12/03/16, 08:43 ? ...
0
votes
1answer
205 views

Create a new post on a specified publish date via link?

I've written a Wordpress calendar plugin and would like to put an "Add Post" link on specified days (i.e., those without posts): When I click the link, I'd like to be taken to the "Add New Post" ...
1
vote
2answers
1k views

pre_get_posts filter using numeric meta_query comparison (from dates)

I have an expiry date ACF field 'post_end_date' which has been applied to multiple post types, including 'post'. I'm trying to filter out any posts, across the entire site, where today's date is ...
0
votes
1answer
67 views

Adding a number to a date

I confess... My php skills are bad. I'm trying to show an events duration within a post in an events category. Example: Oct 11-14 But I'm having a problem adding an integer to a date then printing ...
0
votes
1answer
905 views

Get current week's day and time outside the loop

I am trying to get the current week's day and time based on WordPress time settings. So for today, I want to output Friday and 2:56 PM for the time. The the_time('l') and the_date('d') functions ...
0
votes
2answers
3k views

How replace post date with event date

I need to show the event date instead of the (default) post date for each post. How can I do this? I tried with Event Post plugin, but I can't get the event date and put it overwriting the published ...
0
votes
1answer
77 views

Want to display my custom date archive to date.php but dont know how

Im having a problem with the custom date archive on how to display it to date.php Here's my code for the custom archive <?php $o_query_result = new WP_Query( array( 'posts_per_page' => -1,...
0
votes
2answers
769 views

Translate current_time

I have current_time in theme and it displays date like: THURSDAY, NOVEMBER 10, 2016. But I need to translate it to Persian. How can I do this?
10
votes
2answers
52k views

WP_Query orderby date not working

I have a simple WP_Query to get a list of posts of co-author (taxonomy author) order by date, this is the query : $username = get_the_author_meta( 'login', $author_id ); ...
0
votes
1answer
356 views

Change Post Publish Date to Post Modified Date in All Places

I need to change post publish date to modify date every where in my theme. I know that I can use the_modified_date() function to display post modify date. But changing in every place takes too much ...
0
votes
1answer
65 views

Compare date of user's last posts

I want to compare the date of a user's last two posts. I'm new to WordPress developing. I have written this code but I'm not sure if it's correct. Please help me in correcting it: $ID ...
0
votes
1answer
62 views

Post: how to set created date after post has been published [closed]

For example: i click create post at Friday i edit post data i left this post opened and not published till Monday i publish this post at Monday as published date i see Friday. But why? I want to ...
1
vote
2answers
78 views

Show a different post every 3 days [duplicate]

We have a section on the homepage where we'd like to show a different (random) post every 3 days. I'm trying to figure out a way to do it. This would give us a weekly post, but I don't know how to ...
1
vote
1answer
3k views

Get last revision author, author-link and date

I have some trubles to get the last modified date and author from a post. <?php the_modified_author(); ?> <!--/*and*/--> <?php the_modified_date(); ?> Unfortunateli this two ...
0
votes
1answer
102 views

Adding post date to ACF field

I'm using ACF to display a featured post on the front end of my site. I need the date of the post to be displayed as well. Here is my current code:` FEATURED POST ...
0
votes
1answer
126 views

Include post_date in search

I'd like to search posts by year. For example, I could type in "June 2015" and all posts from that time appear. Or, I could type "2015" and all posts from the year appear. Currently, I have ...
0
votes
1answer
117 views

Create a list of months based posts

Hey WordPress Development, Currently, I have to create a list of months based on the date query of custom posts I have for the current year. I am probably not saying this right so hopefully my format ...
2
votes
1answer
253 views

the_modified_date returns published date

I wanna display modified date instead of published date. I have this code in my theme: echo '<li><i class="fa fa-clock-o"></i> <span class="post-date updated">' . get_the_date(...
1
vote
1answer
413 views

Complex date range with WP_Query and BETWEEN

Backstory We have a bunch of events inside an events custom post type. They each have the following custom fields associated to them: start_date end_date On the front-end, we have a sidebar with ...
0
votes
1answer
648 views

Filter posts by current date ( WP Post Carousel )

So i managed to filter the posts with this snippet : <?php echo " works"; $current_day = date('j'); $current_month = date('M'); query_posts('day='.$current_day.'&month='.$current_month); if ...
3
votes
1answer
2k views

How to remove published date <pubDate> from RSS feed

I've removed dates from my theme because all of my content is evergreen. The dates aren't visible to visitors or search engine crawlers on the site. But people can still see dates in my RSS feed with ...
0
votes
1answer
44 views

YearMonth datequery

I'm trying to make use of the Date Parameter 'm' which is for the YearMonth. I can't figure out what the query name is or how to use it to search for posts with it. Thanks
2
votes
4answers
9k views

Modify Date Format to German

I basically need to change the date format to german date format all over the WordPress site and I succeed it by changing the date time settings from the WordPress admin panel. Settings » General :...
0
votes
1answer
382 views

wordpress meta value compare between two date

I want to check date between two year of birth. But my saved value is date of birth. Meta key "birth_date". Now I want to check value between years using year. My saved date format like "01/01/1995" ...
1
vote
1answer
2k views

Count days from registration date to today

I'd like to add extra text to users who signed up for more the x days. My function is as follows: $today = current_time( 'mysql' ); $days_diff = date( 'd', $today); $...
2
votes
1answer
189 views

Limit content by user registration date

I am looking for a code that will allow me to restrict access to content based on a User Registration Date. Therefore, if a user registers after content has already been posted then the user will not ...
2
votes
1answer
5k views

Converting Unix timestamp to wordpress date

I have trouble converting Unix timestamp (i.e. 1473897600) to Wordpress friendly date which displays at the date input field. I have a frontpage, post edit panel which is showing Unix timestamp. I ...
2
votes
1answer
121 views

Displaying custom posts only if custom meta box's date is not expired

I have a problem with displaying custom posts - I want each post to show only if a date set in a custom field has not passed. I can't figure out the where I should put the if statement in the code. ...

1 2 3
4
5
11