This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'posts_search', 'my_search_is_perfect', 20, 2 ); | |
function my_search_is_perfect( $search, $wp_query ) { | |
global $wpdb; | |
if ( empty( $search ) ) | |
return $search; | |
$q = $wp_query->query_vars; | |
$n = !empty( $q['exact'] ) ? '' : '%'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function register_facets( $facets ) { | |
$facets[] = array( | |
'label' => __( 'Group', 'aplatform' ), | |
'name' => 'group', | |
'type' => 'fselect', | |
'multiple' => 'no', | |
'source' => 'acf/field_5s9a5l2s921df', // acf select field | |
'label_any' => __( 'everything', 'aplatform' ), | |
'orderby' => 'display_value', | |
'count' => '100', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Capture user login and add it as timestamp in user meta data | |
* | |
*/ | |
function 12kdksd212_user_last_login( $user_login, $user ) { | |
update_user_meta( $user->ID, 'last_login', time() ); | |
} | |
add_action( 'wp_login', '12kdksd212_user_last_login', 10, 2 ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ifModule mod_headers.c> | |
Header set Access-Control-Allow-Origin: * | |
</ifModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function c4a8a13f4e5_woocommerce_shortcode_products_query( $query_args, $atts ) { | |
$query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; | |
return $query_args; | |
} | |
add_filter( 'woocommerce_shortcode_products_query', 'c4a8a13f4e5_woocommerce_shortcode_products_query', 10, 2 ); | |
function c4a8a13f4e5_shortcodes_pagination() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Exclude pages from Jetpack top posts widget | |
* | |
* @param array $posts | |
* @param array $post_ids | |
* @param int $count | |
* @return array | |
*/ | |
add_filter( 'jetpack_widget_get_top_posts', 'exclude_widget_get_top_posts', 10, 3 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'posts_where', 'search_by_sku' ); | |
function search_by_sku( $where ) { | |
if( ! is_search() ) { | |
return $where; | |
} | |
global $wpdb; | |
$query = get_search_query(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
Google sitelinks search box, people can reach your content more quickly from search results. | |
More information on sitelinks: | |
https://developers.google.com/webmasters/richsnippets/sitelinkssearch | |
{% endcomment %} | |
<script type="application/ld+json"> | |
{ | |
"@context": "http://schema.org", | |
"@type": "WebSite", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_cart_item_name', 'cart_low_stock_note', 10, 3 ); | |
function cart_low_stock_note( $title, $cart_item, $cart_item_key ) { | |
if( $cart_item ) { | |
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); | |
$output = ''; | |
$output.= $title; | |
// threshold | |
if( $_product->get_stock_quantity() <= 4 ) { |
NewerOlder