The tag has no wiki summary.

learn more… | top users | synonyms

15
votes
4answers
12k 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
381 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
9k 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 ...
6
votes
3answers
4k 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 ...
5
votes
2answers
3k 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
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
4answers
6k 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 ...
4
votes
3answers
824 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
2answers
8k 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
1answer
76 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
79 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
2answers
83 views

How to schedule multiple posts while adding new

In a WordPress powered news portal, they need to upload many news at a time on a certain period of a day, in most of the cases, after 10pm (today). But they are actually inserting news for the next ...
3
votes
3answers
1k 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
2k 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
2answers
32 views

Using WP_Query To Get Posts Randomly From today

In the logic of the data_query(); I found this WP_Query sample: <!-- Second Senses Featured --> <ul id="featuredSecond" class="featured-second"> <?php $today = ...
3
votes
1answer
1k 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
1k 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 ...
3
votes
1answer
580 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
454 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
130 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
1k 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
2k 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
3k 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
230 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
1answer
248 views

Wordpress Custom Query to show posts from last x years

I have found a way to show all posts from the current year with this code: <?php $today = getdate(); $lastyear = $today[ 'year' ]; $args = array( //'nopaging' => true, 'paged' => ...
2
votes
2answers
110 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
377 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
1k 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
2answers
2k views

How would I bulk change posting date?

How would I bulk change posting date? I want to change about 20 post publish dates at a time in one click
2
votes
2answers
710 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
131 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
2k 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
859 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
186 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
182 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
2answers
196 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 ...
1
vote
2answers
225 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
5k 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
2answers
7k views

How to get the date of a post in WordPress, so I could use it in a script?

I'm very new to WordPress. I need to get the date of a post and compare that date to a specific date (04/01/2011), so add some banners and stuff to every post created "after" that pivot date. But the ...
1
vote
1answer
479 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. ...