List taxonomy terms plus their latest post ordered by post date

Right now you are performing the query by term, and displaying results instantly. What you need is to gather the results of each query, sort them and then display separately. Make sure to read code comments. /* $custom_terms = get_terms(‘columna’); – this approach is depreciated */ $custom_terms = get_terms( array( ‘taxonomy’ => ‘columna’ ) ); … Read more

Custom WP_Query breaks default behaviour of viewing right post associated with tax-term!

You second query performs an entirely new query and does not have the terms set. Besides, it’s not as efficient to ‘redo’ the query. Instead, hook into pre_get_posts and change the order there: function change_order_for_events( $query ) { //Check if currenty query is the ‘main query’ and event type taxonomy being viewed if ( $query->is_main_query() … Read more

Display Custom Taxonomy Terns ordered by meta_value

Assuming the position field is filled with numbers to give order: have a look at ksort. <?php $terms = get_terms(‘brands’); // Let’s create our own array and then reorder it $order_terms = array(); foreach( $terms as $term ) { $position = set_up_the_position_meta_here; $order_terms[$position] ='<h2>’.$term->name.'</h2>’; } // now lets reorder the array based on keys (position) … Read more

Order posts ascending with number in title

Old answer (which no longer works): A sneaky way to do it using MySQL, assuming the number’s always at the end, is to reverse the title, convert it to a number (+0), and then reverse again and convert it to a number: function wpse174646_posts_orderby( $orderby, $query ) { if ( $query->get( ‘orderby’ ) != ‘title_number’ … Read more

Order Custom post type loop by custom field (datepicker)

Your second approach should in my mind actually work, you do it like this: Code: $args = array( ‘post_type’ => ‘agenda’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘datum_agenda’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ); $my_query = new WP_Query( $args ); There are two pages at the ACF documentation you might want to read: Date Picker … Read more

Set number of article per number of page

Pagination is result of combining two factors: page size and offset. In common case page size is constant and offset is page size times current page. Is it possible to build highly elaborate pagination you describe? Technically yes. That would be matter to adjusting page size and offset in a more elaborate fashion. However specific … Read more

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