XML-RPC and post_date

There are a couple of issues here. First of all, wp.editPost takes a fourth parameter before the content struct -> the ID of the post you’re trying to edit (should be an integer). Second, you’re passing a string for the post_date, so the client automatically converts this to a <string> tag before sending it to … Read more

Comparing dates in custom field

Your date format is in the wrong order. Think of it from a strictly numerical perspective- 11222012 > 1032013 Dates should follow the MySQL date format in descending units- yyyy-mm-dd

Arrange posts by date in front page

Add orderby and order to your arguments: $cat_query = new WP_Query( array( ‘post__not_in’ => get_option( ‘sticky_posts’ ), ‘category__in’ => array($cat->term_id), ‘posts_per_page’ => 5, ‘paged’ => $paged, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ ) ); Update it seems it still takes one category, lists 5 posts and then goes to another, with 5 posts etc. It … Read more

Get random posts between specific dates / of specific age

Two notes beforehand: There is no (unless you created a CPT) post type random_posts. Don’t use query_posts. That being said, the following will do what you want: Just the randomness $args = array( ‘posts_per_page’ => ’10’, ‘orderby’ => ‘rand’ ); $random_posts = get_posts( $args ); foreach( $random_posts as $random_post ) { // do something echo … Read more

How to get date using timezone saved in options? [duplicate]

I use this: $mytheme_timezone = get_option(‘timezone_string’); date_default_timezone_set($mytheme_timezone); in my themes functions.php. For me this has worked without any warnings. I’ve also tested whether my script is in different timezone than php.ini: if (strcmp($mytheme_timezone, ini_get(‘date.timezone’))){ echo ‘Script timezone differs from ini-set timezone.’; } else { echo ‘Script timezone and ini-set timezone match.’; } Please improve this … Read more

Advanced custom fields: Customise date picker’s start date (need to choose year 1500 onwards) [closed]

You can do this by customizing the plugin. You’ll want to find timepicker.js in /wp-content/plugins/acf-field-date-time-picker/js/timepicker.js And change line 21: , yearRange: “-100:+100” to your preferred range, for example: , yearRange: “-500:+100” This gives you a dropdown that, by default, goes back 500 years and forth 100, from the current year. Or you can hardcode a … Read more

What’s wrong with my date_query?

‘date_query’ argument takes an additional option that is ‘relation’ that can be AND or OR. If we consider the relation OR your code, that use exactly same date for ‘before’ and ‘after’ with ‘inclusive’ set to true, should return all your posts: posts before a date + posts after that date + posts in that … Read more

Display post from specific date

I think if you want to show recent posts posted 2-3 days ago, you can use date queries, provided by WordPress You can get more information about date queries from here: WordPress Date Queries For Example: If you want to show last three days posts, it can be done using the following snippet of code: … Read more

Individually styling date month year [closed]

As suggested, you can break down the date format in different parts. echo ‘<span class=”date-day”>’ . get_the_date( ‘d’ ) . ‘</span>’; echo ‘<span class=”date-month”>’ . get_the_date( ‘M’ ) . ‘</span>’; echo ‘<span class=”date-year”>’ . get_the_date( ‘Y’ ) . ‘</span>’; Now each item have class associated with it, so you can style each differently as you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)