The tag has no wiki summary.

learn more… | top users | synonyms

12
votes
3answers
9k views

How to get WordPress Time Zone setting?

Can someone tell me how to get the time zone that is set in the WordPress Admin? For example, if the blog is set to Eastern time, I need this exact string to print out: US/Eastern This is for a ...
12
votes
2answers
292 views

Unable to select an old date in wordpress

I am unable to set the year below 1899 for a post. If i set year below 1899 it is set to the current year automatically. I have purchased the Timeline theme and asked in their support forum. They ...
9
votes
3answers
8k views

Order by meta value or date?

Got a custom field called startDate but its only on a few events. I was wondering if it isn't set for a post I could use post_date to generate the posts list? // if meta_key _postmeta.startDate isn't ...
4
votes
4answers
1k views

order posts by date like craigslist

the image is worth a thousand words. take a look at it. you know how craigslist has posts organized by date ..ex Tue 3 post links for tuesday Wed 4 post links for wed Thurs 5 post links for ...
4
votes
3answers
5k views

Custom Post Type Archives by Date and Taxonomy

Lets use the classic example of a custom post type called "movies", with its own taxonomy called "genre". By registering the custom post type (with a "movie" slug), the permalinks are already set up ...
4
votes
2answers
2k views

Default timezone hardcoded as UTC?

While debugging a plugin I was writing, I noticed that on line 36 of wp-settings.php, the default timezone is hardcoded to UTC with a call to the date_default_set_timezone() function. This means any ...
4
votes
3answers
495 views

Running WP Cron on specific local time

The scenario is to run insert_post function every midnight (00:00) of local time. Must run daily on weekday. function add_daily_task(){ if((date('l', time()) != 'Saturday') || (date('l', time()) ...
4
votes
1answer
1k views

Custom Post Type Archives by Date with Custom Permalink

I'm a bit stuck with getting the custom permalink for custom post type (CPT) archive to work. I've registered my 'press_release' CPT as following: add_action('init', 'press_release_post_type_init'); ...
3
votes
3answers
2k views

Converting timestamps to local time with date_l18n()

I've got a WordPress cron job that sends an email periodically and saves the timestamp when it was sent as an option, and I'd like to display a date on a settings page. Something like, "The last ...
3
votes
2answers
6k views

Convert jQuery Datepicker Format to SQL Date Format

I set the jQuery Datepicker format to D d.m. displayed as Th 3.3. for a custom meta field that I want to use to sort posts. In SQL, the custom meta field is saved as D d.m. I would like to display ...
3
votes
2answers
2k views

What's the difference between get_the_time and get_the_date?

Both function returns date and time. What's the difference between them? Do you have any example? Thanks.
3
votes
4answers
5k views

Sorting a query by custom field date

EDIT: Reworded the question for more clarity I'm trying to sort by custom meta box data, which I am converting to a date using the strtotime function, but I'm having some difficulty. My chief ...
3
votes
1answer
73 views

How to display date such “x ago”

I want display date based on how much time has passed since, i. e. Posted 12 minutes ago
3
votes
2answers
76 views

What is the best workaround for supporting all existing DATEs?

I want to make a weblog that has with every date 1 or more weblog posts, e.g.: Januari 24 Year 41 : Roman Emperor Caligula was murdered by Cassius Chaerea and the disgruntled Praetorian Guards. ...
3
votes
3answers
856 views

Set Custom Post Type title to the Post's Date

I have a custom post type, called 'status' and I have disabled 'title' in the post type. Right now it's setting all posts to have the title "Auto Draft". I want to set up a way to set the title to be ...
3
votes
1answer
1k views

Display last login time

I am using this script to get the last time a user logged in function get_last_login($user_id) { $last_login = get_user_meta($user_id, 'last_login', true); echo human_time_diff($last_login) . ...
3
votes
1answer
636 views

Formatting custom meta box date from YYYY/MM/DD to a more readable alternative

QUESTION This is following a previous question that was graciously answered by Milo earlier here - How to sort CPT by custom meta value (date), and return posts month by month In short, I'm having ...
3
votes
1answer
419 views

Is it safe to use 'date_default_timezone_set' in plugin file?

I am using a sitemaps plugin which in very complex ways sets the timezone of <lastmod> (i.e. last modified time) for posts to GMT. Temporarily, until the plugin developer fixes it, I need to ...
3
votes
1answer
446 views

Custom Post Type Archives by Date (stored as meta value) WP3.1

I would like to implement date-based archive functionality (similar to original WP Archives widget functionality) for custom post type (CPT). What makes it difficult is the fact that I need to group ...
2
votes
2answers
111 views

Echo Messages By Checking current_time()

Before asking for help I would like to clarify that I don't have advanced skills on PHP. What I want to achieve is to display different messages for every period of time that I set (I need this to ...
2
votes
5answers
825 views

Get date of last update outside of loop

I'm trying to figure out how to display the date that a post was last updated outside of the loop. I'm able to display the published date using get_the_time() but there doesn't seem to be a "loopless" ...
2
votes
3answers
1k views

Why time functions show invalid time zone when using 'c' time format?

These are the functions I use in my theme to display the "entry-meta" which includes published and last modified dates (among others) of an article: // Shows Author and Published Date if ( ! ...
2
votes
1answer
1k views

How to Delete Old Comments by Date?

I run a contest/giveaway blog at www.mommylivingthelifeofriley.com and currently have over 160,000 comments on 1100 posts. I would like to find a way to delete all comments from my site which are ...
2
votes
1answer
2k views

Whats the way to format a date after using get_posts()

I see that theres no way to get a formatted date from a function like echo get_the_date($post->ID, 'd M Y'); get_the_date only works with the current $post. If I used get_posts() how can I ...
2
votes
1answer
1k views

custom field value date convert to unix timestamp problems

For some reason, I'm having difficulty converting a date value stored in a meta field to a unix timestamp (and back again). If I save the date as a string it all works fine, but if I convert it to a ...
2
votes
1answer
83 views

Custom Field sort not working (WP 3.8.1)

I am trying to sort a custom wp_query using the date format YYYYMMDD (php: date('Ymd') ). This will not be regarded as date field, but rather as a numeric one stored in custom field. My WP-QUERY code ...
2
votes
2answers
3k views

Query between two meta values?

How do I limit the query by two custom meta fields, a start date and an end date? This is what my data looks like: meta_key | meta_value | ------------------------| start_date | 20100131 | //Jan ...
2
votes
2answers
84 views

Unable to set right time in admin and frontend template

When I run a simple php file called test.php (placed in the root of the wp installation) that contains something like that: <?php echo date('H:i:s'); ?> The result is right: 15:30:00 and the ...
2
votes
2answers
344 views

Display future posts?

Is there a way to display posts, scheduled for the future? I want to use the published data as an event date and time, which is obviously in the future. I still would like to use these posts for a ...
2
votes
1answer
856 views

How to filter a dd/mm/yyyy date from a custom field in a query

I'm trying to build a query in order to sort some posts by a date custom field, where the dates are formatted dd/mm/yyyy. It works by querying the database directly with get_results like in this ...
2
votes
1answer
181 views

How do I create a dynamically-updated copyright statement?

I'd like to find an optimized, WP_Query-safe method for generating a dynamically-populated copyright statement for the bottom of my themes. That is to say, I'd like to check the date (by year) of my ...
2
votes
2answers
678 views

Using date stored as custom field to filter posts displayed in admin

This seems like a fairly common problem, but I'm posting this as I've yet to find a solution to my problem here on WP Answers - any help is HUGELY appreciated! Ok - so I have a custom post type of ...
2
votes
1answer
1k views

Plugin for changing a post's category based on it's post date?

Is there a plugin for Wordpress that will change a post's category based on how long that post has existed? I have seen other Wordpress plugins that use a library called "simple pie" to manage a ...
2
votes
1answer
114 views

Query by custom dates in UNIX Time

I actually have a custom date registered in UNIX Time in my database like this: meta_key : custom_date meta_value : 1322697600 and the type of the meta key is a longtext I would like to retrieve ...
2
votes
1answer
1k views

Custom post admin filtering by post meta (the date)

I've created a custom post type for events that uses a custom field to retrieve the date for the event. It works ok and I'm able to filter the displayed results using meta_compare to compare the date ...
2
votes
1answer
783 views

How to insert current date/time in the content of a post?

I'm making a list of suggestion here. I need to insert current date/time for each of my suggestions - they are added accumulatively. If you have any idea on doing that, please share.
2
votes
1answer
105 views

Display post links under month in paginated archive

I'd like to create an archive that lists posts under a month header. The months would just be plain text and the post titles, obviously, would link to the posts themselves! So: October 2013 Post ...
2
votes
2answers
112 views

Date, Time, and Timezones

I am a bit confused about using dates/times along with timezones in WordPress. I have the following questions: What is the purpose of the timezone setting in the Admin -> Settings section? Assume ...
2
votes
1answer
629 views

How to List Events by Year and Month Using Advanced Custom Fields?

I have a custom post type "Kalender_item" with a custom Date Field (YYMMDD). I want to list all the posts on a page sorted by Year and Month. For example: November 2012 (all events that occure ...
1
vote
2answers
183 views

How do you format the date as a two digit year? (ex. “10.12.10” instead of “10.12.2010”)

I did a pretty thorough search and found a couple of closed (and unanswered) topics on the WP forums. Does anyone know if this is possible? The codex doesn't specify this as an option. Thanks!
1
vote
1answer
2k views

Formating the display of a post's date, outside the Loop

I'm using this function to be able to retrieve several data, from outside the Loop: function get_post_data($postId) { global $wpdb; return $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ...
1
vote
4answers
4k views

Proper formatting of post_date for wp_insert_post?

What is the proper way to define the post date when submitting a post from the front end using wp_insert_post (Trac)? My snippet now is publishing with the mysql time... if (isset ($_POST['date'])) ...
1
vote
1answer
340 views

Why does this echo values in the wrong order?

I'm sure there is a simple reason/answer for this: Why does echo 'Archive for '. the_time('Y'); give me 2010Archive for? I had expected it would give me Archive for 2010
1
vote
1answer
2k views

Last time a user logged in

I'm building a site where users log in to view content specific to them. I would like to display the last date and time they logged in. How would I get this information from wordpress? If it ...
1
vote
4answers
1k views

wrong php date()?

hey guys, it's weird and I've never experienced that before. I've created a new blog and a custom theme. I'm using <?php echo date("H:i"); ?>in my theme. The time that's put is 2h earlier. ...
1
vote
1answer
102 views

Calculate future date

I want to calculate a future date based on the date the post is published and use it in the content of a post. I can echo the post publication date using: echo the_date('Y-m-d'); How can I ...
1
vote
1answer
750 views

Displaying year, month and day archives differently

I'd like to display daily archives differently than monthly/yearly archives. How do I check to see if the archive template is being pulled for a daily archive vs. a monthly/yearly archive?
1
vote
1answer
36 views

php console log speed [closed]

How do I log speed benchmarks to a console in php? I don't want to echo the results for the user to see, but just in some kind of log. I know that I can get the time elapsed with this: $first = ...
1
vote
1answer
42 views

“is_new_day()” alternative for years?

I don't believe there's a is_new_year() function in WordPress, as an alternative for is_new_day(). I'm trying to display the year only once for each set of posts, what would be the best way to do ...
1
vote
1answer
178 views

Finding difference in days

I want to store the current time using the update_option and then compare it if the set time was 3 days ago. I want to know in what format I should store the time? and then how can I compare it with ...