Using WP meta query to show custom post types by a start and finish date

The query will by default GROUP BY the post ID, meaning that a post will only appear once in the list. You can remove that GROUP BY pretty easily with a filter: add_filter(‘posts_groupby’,’__return_empty_string’); $events = new WP_Query($args); remove_filter(‘posts_groupby’,’__return_empty_string’); That might get you what you want. It is a bit hard to tell. Without the GROUP … Read more

Ordering custom posts by meta field date

You are not querying/saving the correct meta_key. For example, looking at your code, you pass $typename variable to update_post_meta() as meta_key and $typename=”events”. But later in the query you are querying for meta_key = date. Also, you pass $meta as meta_value and in your actual code $meta is an array containing multiple values (location, date, … Read more

Show different time stamp based on time

Check out human_time_diff(): if ( DAY_IN_SECONDS < ( $time = current_time( ‘timestamp’ ) ) – ( $time_post = get_the_time( ‘U’ ) ) ) echo human_time_diff( $time_post, $time ) . ‘ ago’; else the_time( ‘F j, Y at g:i a’ ); DAY_IN_SECONDS is a handy “helper” constant in WordPress, along with: MINUTE_IN_SECONDS HOUR_IN_SECONDS WEEK_IN_SECONDS YEAR_IN_SECONDS

Retrieving posts by their date and category

Please try the following code: Following code has to be added in shortcode function global $wpdb; $start .= $attr[‘godina’] . “-09-01”; $end .= $attr[‘godina’] + 1 . “-08-31”; $cat = $attr[‘cat’]; //$cat must be category name. $cat_term_id=get_term_by(‘name’, $cat, ‘category’); $term_id=$cat_term_id->term_id; $query = array( ‘post_type’ => ‘post’, ‘tax_query’ => array(array( ‘taxonomy’ => ‘category’, ‘field’ => ‘term_id’, … Read more

Remove Page Timestamp via functions.php so it doesn’t show in Google Search Result Description [closed]

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 … Read more

How to show list of posts with custom field value (a date) that are coming soon

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 around them … Read more

Limit loop to future events

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( ‘key’ => ‘date_of_event’, ‘value’ => date( ‘Y-m-d’, current_time( ‘timestamp’ ) ), ‘compare’ => ‘>’, ‘type’ … Read more

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