SQL order by fields
SELECT * FROM wp_posts WHERE ID IN (5,26,4) ORDER BY FIELD(ID,5,26,4)
Hi guys !!! How to add like button in media gallery item using Buddypress and rtMedia WordPress plugin? Please follow the steps below. Step 1: Override the “media-gallery-item.php” in your WordPress theme. wp-content/themes/mytheme-folder-name/rtmedia/media/media-gallery-item.php Step 2: Place the code anywhere inside of your “li” tag. <?php wdes_rtmedia_like( rtmedia_id(), bp_loggedin_user_id() ); ?> Step 3: Paste this code…
How to get current product category slug? global $wp_query; echo $wp_query->query_vars['product_cat'];
How to check if there is an ajax running on your page? Here’s a code below that can help you figure it out. jQuery( document ).ready(function($) { $(document).ajaxStart( function() { console.log('ajax true' ); }).ajaxStop( function() { console.log('ajax false' ); }); });
function widget_first_last_classes($params) { global $my_widget_num; $this_id = $params[0]['id']; $arr_registered_widgets = wp_get_sidebars_widgets(); if(!$my_widget_num) { $my_widget_num = array(); } if(!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) { return $params; } if(isset($my_widget_num[$this_id])) { $my_widget_num[$this_id] ++; } else { $my_widget_num[$this_id] = 1; } $class = 'class="widget-' . $my_widget_num[$this_id] . ' '; if($my_widget_num[$this_id] == 1) { $class .= 'first '; } elseif($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id]))…
function woocommerce_shop_ordering_add_option( $sort_args ){ $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); if ( 'alphabetical' == $orderby_value ) { $sort_args['meta_key'] = 'property_priority'; $sort_args['orderby'] = 'meta_value'; $sort_args['order'] = 'DESC'; } return $sort_args; } add_filter( 'woocommerce_get_catalog_ordering_args', 'woocommerce_shop_ordering_add_option' ); function woocommerce_catalog_orderby_add_option( $sortby ) { $sortby['alphabetical'] = 'Sort by STC'; return…
If you want to create a drop-down menu, I have a sample codes below. It is very simple but will put your mobile much user friendly. It’s up to you on how you design the layout. I’d like to recommend to use WDES Responsive Mobile Menu if you want your mobile views won’t take so…