Random order of posts on each request

Use jQuery on your page to sort the divs. Ideally you want your divs to all have the same CLASS so you can identify which divs to randomize. I’m not familiar with the thesis theme but presumably there is a testimonials.php or something similar you could modify. If so, add your jQuery in there. Here’s … Read more

Problem with meta_value order after update

Try WP_Query() instead of query_posts() $args = array( ‘posts_per_page’ => 10, ‘meta_key’ => ‘t_count’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ); // The Query $the_query = new WP_Query( $args ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; endwhile; // Restore original Query & Post Data wp_reset_query(); wp_reset_postdata(); … Read more

reorder a WP_Query, using a dropdown

I guess the problem is $qry = new WP_Query(array(‘category_name’=>$GLOBALS[‘city’],’order’=>$orderby)); Let’s just say $orderby is orderby=title&order=ASC Then the order argument of WP_Query will be like this: ‘order’=>’orderby=title&order=ASC’ However, order argument only accepts: ASC and DESC. You should do somethings like this: WP_Query(‘category_name=”.$GLOBALS[“city’].’&’.$orderby);

Woocommerce: Grab total revenue of a product over all orders

Got it solved. Probably not the most efficient way but it works! SELECT product_id, meta_value FROM ( SELECT order_meta.order_item_id, order_meta.meta_value AS ‘product_id’ FROM wp_woocommerce_order_itemmeta AS order_meta LEFT JOIN wp_woocommerce_order_items AS order_items ON order_meta.order_item_id = order_items.order_item_id LEFT JOIN wp_term_relationships AS term_rels ON term_rels.object_id = order_items.order_id WHERE term_taxonomy_id = 24 AND order_meta.meta_key = ‘_product_id’ ) AS product_ID … Read more

Transfer taxonomy to custom field

You can order posts by custom taxonomy terms by adding a posts_clauses filter, see below answer: https://wordpress.stackexchange.com/a/14313/14499 Make sure that on functions.php you add both that function AND the call to add_filter(‘posts_clauses’, ‘orderby_tax_clauses’, 10, 2 );, otherwise it won’t work. Assuming annee is the custom taxonomy, this should then work: query_posts($query_string . ‘&posts_per_page=-1&orderby=annee&order=ASC’);

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