Tag Info

New answers tagged

0

Needed to enter correct date format: Ymd or yyyy-mm-dd.


0

As stated in my comment to the OP, you should make use of pre_get_posts to target change the query variables as needed before the main query is executed. Just a tip, pre_get_posts uses the same exact parameters as WP_Query, so you can have a look at those parameters and use them to construct your pre_get_post action parameters to modify the query variables ...


0

Just guessing, but try this: $args = array( 'post_type' => 'my_content', 'orderby' => 'meta_value', 'meta_key' => 'start_month', 'meta_query' => array( array( 'key' => 'start_month', ), ), ); $thisQuery = new WP_Query( $args );


1

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( ...


1

The short answer: you need to modify the query for your single event post to include the metadata, so only posts with matching name, year, and month will be returned. I'll show you the complete code I used to test this. I made a few changes to your code and simplified a few things, so be careful that all functions are updated. First, the rewrite tags used ...


6

Why does it not show? When you look at the source of the the_date() function, then you will notice two globals: global $currentday, $previousday; And then there's a rule if there's a date to display ... or not. The check is similar to the one done with is_new_day(): if ( $currentday != $previousday ) { // show date // Set global ...


3

I faced similar issue in past because I modified my date function. And then posts were displaying date if only each post has different date otherwise it returned blank. Try adding <?php echo get_the_date(); ?> instead.


3

Don't use the_date(), instead use the_time(). the_date returns the date only, the_time returns the date + the time. I don't know the reason why wordpress won't return more than one date when the_date is used in a loop. But it has to do with the fact that the value is the same. If you use the_time the value is never the same, therefore it always returns the ...


1

Use get_the_date() if you want to change the date format. get_the_date( 'S F Y', $post ); The 2nd argument is optional and only needed outside the loop.


0

Not sure what kind of plugin you're using there, but my guess would be: <?php if($block === 'title'): ?> <h2 class="post-title"> <?php echo empty($link_setting) || $link_setting!='no_link' ? $this->getLinked($post, $post->date, $link_setting, 'link_title') : $post->date ?> </h2>



Top 50 recent answers are included