Tag Info

New answers tagged

1

You're not using query_vars quite right - this filter is for whitelisting "public" query vars, not actually setting their values. It's also called rather early (wp::parse_request), so any conditional tags like is_tax() will always be false at this stage. Use the pre_get_posts action for overriding the default query. Having said that, you need a custom ORDER ...


1

Couldn't find anything built in to WP to do this, but there's a good tutorial on this site for setting something up like this: This does not support custom format so I recommend using the original post function http://www.renegadetechconsulting.com/tutorials/jquery-datepicker-and-wordpress-i18n You can also find a Gist of the code here: ...


0

You can use <?php human_time_diff( $from, $to ); ?> to return a human readable time difference. Take a look at the Wordpress Codex Function Reference/human time diff.


2

Here you go. This goes in functions.php This changes the time on your website everywhere. Now you can keep using <?php echo get_the_date(); ?> in your loop or theme files. // Relative date & time function wpse_relative_date() { return human_time_diff( get_the_time('U'), current_time( 'timestamp' ) ) . ' ago'; } add_filter( 'get_the_date', ...


1

Assuming your date is in the correct format for proper ordering (yyyy-mm-dd), add a meta_query to your args: $args = array( 'post_type' => array('basic_events'), 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => 'date_of_event', 'paged' => $paged, 'meta_query' => array( array( ...


1

Firstly, the_post() doesn't actually output anything - it just sets up the post data ready to output. You'll need to do something like this to show the posts: <?php while ( $loop->have_posts() ) : $loop->the_post(); the_title(); the_content(); endwhile; ?> There's several more tags you can use and you'll want to format the HTML ...


0

the_date() is technically the template tag to do it. However it has a somewhat unusual aspect to only output once per date, so if there are multiple posts on page from same date they won't all show it. get_the_date() is one level lower and retrieves (not outputs) a post's date without that bit of logic.


0

In get_the_date($d, $the_post->post_parent); are you setting that $d variable somewhere? If not, try changing it to get_the_date('Y', $the_post->post_parent); You can probably also simplify if(strtotime($origpostdate) < strtotime("2015")){ to just if(strtotime($origpostdate) < 2015){


0

All of the code needed to work: function wpd_remove_modified_date(){ if( is_page() ){ add_filter( 'the_time', '__return_false' ); add_filter( 'the_modified_time', '__return_false' ); add_filter( 'get_the_modified_time', '__return_false' ); add_filter( 'the_date', '__return_false' ); add_filter( ...


1

It depends on what the template uses to output whatever you're trying to remove. If you look in source at whatever function is outputting what you want to remove, they each have a filter to let you modify output where you can __return_false instead, however, if there's text or markup surrounding those template tags, your only option is to modify the ...


1

Saving the date in post meta is a slightly more sane approach, the post_date column was not designed with your use case in mind. You may get weird results with dates before the Unix epoch (January 1, 1970). Then it's just a simple meta_query to load posts between dates, no filter necessary. $start = '1900-01-01'; $end = '1949-12-31'; $args = array( ...


0

Well, WP may be suppressing your filter. Per the WP Codex on posts_where @: http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where Certain functions which retrieve posts do not run filters, so the posts_where filter functions you attach will not modify the query. To overcome this, set suppress_filters to false in the argument array passed to ...


1

The post_date and post_date_gmt serves as the date that the post was created. For scheduled posts this will be the date on which the post is scheduled to be published. There is no reliable native method to determine the date when a scheduled post was added. For scheduled posts, you can try the post_modified or post_modified_gmt dates as this will correspond ...


0

Use get_the_date(); to get the date defined in the meta box "Publish" at the field "Published on ..", this usually is the date the user created the post unless (s)he change it.



Top 50 recent answers are included