WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
Updating Media Published Date When Parent Post Is Modified in WordPress
How do display most popular post from a year earlier to the day?
If the given code is correct it might be the missing brackets on your pre_get_posts conditional. Let’s format it with proper indentation and spacing: function alter_query( $query ) { if( $query->is_main_query() && is_home() ) $query->set( ‘cat’, ‘2’ ); $query->set( ‘orderby’, ‘rand’ ); } add_action( ‘pre_get_posts’,’alter_query’ ); Because there’s no brackets for your conditional statement, it … Read more
Events are all showing the current date
Just for people passing by, for putting together all this code was not trivial. The problem was actually the lack of data. I solved adding data as metakey (added in my case when the order changes status) and echoing it as the column value. So the full code is: // Adding a new column to … Read more
Mini app that shows one unique quote each day. 56 rotating posts rotating for each themed weekday. It works, but I need your advice
I’m wondering if I can use any of the functions listed in the @wordpress/date package to convert a GMT date to a date in the user’s locale. Yes, you can use the dateI18n() function. However, the source date (i.e. the 2nd parameter for the above function) by default uses the time zone of the user’s … Read more
Looks like you asked this question elsewhere, PROBLEM: WordPress Support Forum SOLUTION: PasteBin AUTHOR: Alan Jackson For reference: <?php echo ‘<ul id=”timeline”>’; echo ‘<li>Latest</li>’; $prev_month=””; $prev_year=””; $args = array( ‘posts_per_page’ => 10, ‘ignore_sticky_posts’ => 1 ); $postsbymonth = new WP_Query($args); while($postsbymonth->have_posts()) { $postsbymonth->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/50592/<?php the_permalink(); ?>”><?php the_time(‘j’); ?></a></li> <?php if(get_the_time(‘F’) != $prev_month || … Read more
Firstly, you need to remove the paragraph tags that were added by the wp_autop filter. There’s another answer that covers this pretty well: Is there an uw-wp_autop function? I’m going to change the function a little for our purposes (based on the markup example you gave): function reverse_wpautop( $s ) { // Strip newlines $s … Read more