I don’t arrive to do order_by title when i have a conditionnal year in a request

I tried your code and is working fine for me $args = array( ‘post_type’ => ‘project’,’posts_per_page’ => -1,’year’ => date(‘Y’) – 2, ‘orderby’=> ‘title’,’order’ => ‘ASC’); $myposts = get_posts( $args ); The thing is as you can see he is only fetching the posts from 2015. If you don’t have any posts with the publish … Read more

Orderby ASC changes to DESC in WP_Query

You’ve made “orderby” and “order” part of the date_query sub-array. “Order” parameters belong to the main parameters array. I can’t vouch for the part of your code that concerns the year and the above-undefined variable $ppy, but if you want the posts from a specified year in ascending order by ‘post_date’ (which is the default), … Read more

Same date is repeating on my custom ‘Most Recent Posts’ on sidebar

The same date is always displayed because of the use of echo get_the_date(‘F j, Y’). As you can read in the documentation: The get_the_date template tag retrieves the date the current $post was written. Change get_the_date(‘F j, Y’) to get_the_date(‘F j, Y’, $value->ID) and it should work. Or without additional DB queries: <div class=”c-singlepost__sidebar__articles-item-date”> <span> … Read more

How to display upcoming events by dat with Modern Events Calendar Lite

i have found a solution, making a custom SQL query here is the code ( using WPML ) $startday = date(“Y-m-d”); if ( defined( ‘ICL_LANGUAGE_CODE’ ) ) { $lang = ICL_LANGUAGE_CODE; } //echo $startday; global $wpdb,$post; $results = $wpdb->get_results( “SELECT * FROM wp_posts, `wp_mec_dates` AS mecd, wp_icl_translations WHERE wp_posts.ID = mecd.post_id and post_status=”publish” AND wp_icl_translations.language_code=”$lang” … Read more

display month in french in wordpress/php?

there is a custom function in wordpress called date_i18n. so basically you do echo date_i18n( ‘H:i d-m-Y’, $ts ); without the setLocale stuff.. find the function date_i18n and its parameters here. you could even build in your translation all in there, without the language check before: date_i18n( __( ‘H:i d-m-Y’, ‘textdomain’ ) ); (replace ‘textdomain’ … Read more