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.

WordPress Not Sorting By Custom Field

Please read the documentation. ‘rating’ is not a valid value for orderby. To sort by a custom field you need to use ‘orderby’ => ‘meta_value’ or ‘meta_value_num’. Note that a ‘meta_key=keyname‘ must also be present in the query. Note also that the sorting will be alphabetical which is fine for strings (i.e. words), but can … Read more

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 search for articles containing two words?

Ex. http://www.site.com/?s=as+sa This gives a perfect search result irrespective of the order of words. If you want to add a custom query then you can use following: $query = new WP_Query( ‘s=keyword+keyword2’ ); and iterate through your query result. Try this out.

Can’t sort custom column on user.php by number / meta_value_num?

Instead of ‘request’ function, use this : add_action(‘pre_user_query’, ‘user_column_orderby’); function user_column_orderby($userquery){ if(‘Votes’==$userquery->query_vars[‘orderby’]) { global $wpdb; $userquery->query_from .= ” LEFT OUTER JOIN $wpdb->usermeta AS alias ON ($wpdb- >users.ID = alias.user_id) “; $userquery->query_where .= ” AND alias.meta_key = ‘wp__user_like_count’ “; $userquery->query_orderby = ” ORDER BY alias.meta_value “.($userquery->query_vars[“order”] == “ASC” ? “asc ” : “desc “); } }

Woocommerce – Display product category of product in Orders page

Add Below Code in Your Theme function.php function action_woocommerce_admin_order_item_headers( ) { ?> <th class=”item sortable” colspan=”2″ data-sort=”string-ins”><?php _e( ‘Item category’, ‘woocommerce’ ); ?></th> <?php }; // define the woocommerce_admin_order_item_values callback function action_woocommerce_admin_order_item_values( $_product, $item, $item_id ) { ?> <td class=”name” colspan=”2″ > <?php $termsp = get_the_terms( $_product->id, ‘product_cat’ ); if(!empty($termsp)){ foreach ($termsp as $term) { … Read more

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