Sort wordpress posts by facebook likes [closed]

You can either sort them with jQuery on the front-end, or pull the like count into the back-end and store on the post_meta. Then sort by meta value in your loop. FACEBOOK http://graph.facebook.com/?id=http://{URL} Result { “id”: “http://{URL}”, “shares”: intgr/(number) } Other types of share counts.

Orderby with menu_order and title

MySQL does not do “natural” sorting natively, though there are attempts to make it work. I have no idea how that plugin you mention works but sorting by menu_order with a post_title fallback is trivial. add_action( ‘pre_get_posts’, function ($qry) { if ($qry->is_main_query()) { $qry->set(‘orderby’,’menu_order title’); } } ); Of course, that gets menu_order equal 0 … Read more

How to make WordPress orderby work with post_excerpt column?

I edited the wp_playlist_shortcode function at \wp-includes\media.php WP core file, by adding if ($atts[‘orderby’]==’excerpt’ || $atts[‘orderby’]==’post_excerpt’) { function cmp($a, $b) { return strcmp($a[“caption”], $b[“caption”])*(-1); } usort($tracks, “cmp”); } before $data[‘tracks’] = $tracks; line. Basically after all tracks are generated into the $tracks array and before this array is passed to the final array $data, I … Read more

Woocommerce Pre Orders view order link wrong [closed]

<td class=”order-number” width=”1%”> <a href=”https://wordpress.stackexchange.com/questions/190318/<?php echo wc_get_endpoint_url(“view-order’, $order->id, wc_get_page_permalink( ‘myaccount’ ) ); ?>”> <?php echo $order->get_order_number(); ?></a> </td>; this should solve your problem. But I am not sure which template your are modifying, but fool proof way is only possible with child theme (functionality plugin will be complex for your needs). https://support.woothemes.com/hc/en-us/articles/203105897-How-to-set-up-and-use-a-child-theme http://docs.woothemes.com/document/template-structure/ both of … Read more

Add post order like page order

I find it: add_action( ‘admin_init’, ‘posts_order’ ); function posts_order() { add_post_type_support( ‘post’, ‘page-attributes’ ); }

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

single post navigation order (NOT chronological)

after a lot of trial and error WP transients came to save me!! here is the solution for anyone that might need this… in the index.php (outside the main loop) i save the current random order in a transient: $order_array = array(); while ( $the_query->have_posts() ) : $the_query->the_post(); $order_array[] = get_the_ID() ; endwhile; set_transient(‘post_order’, $order_array, … Read more