// Ajax add to cart on the product page
var $warp_fragment_refresh = {
url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_refreshed_fragments' ),
type: 'POST',
success: function( data ) {
if ( data && data.fragments ) {
$.each( data.fragments, function( key, value ) {
$( key ).replaceWith( value );
This file contains 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
<?php | |
add_filter('wpcf7_special_mail_tags', 'add_prospectus_link_to_email', 10, 3); | |
function add_prospectus_link_to_email($output, $name, $html) | |
{ | |
$name = preg_replace('/^wpcf7\./', '_', $name); // for back-compat | |
if ('prospectus' == $name) { | |
$prospectus = get_field('prospectus', 'options'); | |
return $prospectus['url']; | |
} |
This file contains 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
1. Rename the folder `mysql/data` to `mysql/data_old` (you can use any name) | |
2. Create a new folder `mysql/data` | |
3. Copy the content that resides in `mysql/backup` to the new `mysql/data` folder | |
4. Copy all your database folders that are in `mysql/data_old` to `mysql/data` (skipping the mysql, performance_schema, and phpmyadmin folders from data_old) | |
5. Finally copy the `ibdata1` and `my.ini` files from `mysql/data_old` and replace it inside `mysql/data` folder | |
6. Start MySQL from XAMPP control panel |
This file contains 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
<?php | |
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
// http://youtu.be/dQw4w9WgXcQ | |
// http://www.youtube.com/embed/dQw4w9WgXcQ | |
// http://www.youtube.com/watch?v=dQw4w9WgXcQ | |
// http://www.youtube.com/?v=dQw4w9WgXcQ | |
// http://www.youtube.com/v/dQw4w9WgXcQ | |
// http://www.youtube.com/e/dQw4w9WgXcQ | |
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ |
This file contains 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
<?php | |
add_action( 'pre_get_posts', function( $query ) { | |
if ( $query->is_main_query() && is_woocommerce() && ( is_shop() || is_product_category() || is_product_tag() ) ) { | |
if( $query->get( 'orderby' ) == 'menu_order title' ) { // only change default sorting | |
$query->set( 'orderby', 'meta_value' ); | |
$query->set( 'order', 'ASC' ); | |
$query->set( 'meta_key', '_stock_status' ); | |
} | |
} | |
}); |
This file contains 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
<?php | |
function wpmix_add_rewrite_rules( $wp_rewrite ) | |
{ | |
$new_rules = array( | |
'blog/(.+?)/?$' => 'index.php?post_type=post&name='. $wp_rewrite->preg_index(1), | |
); | |
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules; | |
} | |
add_action('generate_rewrite_rules', 'wpmix_add_rewrite_rules'); |
This file contains 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
<?php | |
/* Thumbnail upscale | |
/* ------------------------------------ */ | |
function wpmix_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h, $crop ){ | |
if ( !$crop ) return null; // let the wordpress default function handle this | |
$aspect_ratio = $orig_w / $orig_h; | |
$size_ratio = max($new_w / $orig_w, $new_h / $orig_h); | |
$crop_w = round($new_w / $size_ratio); |
This file contains 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
<?php | |
// Setup Widgets | |
function wpmix_widgets(){ | |
register_sidebar(array( | |
'name' => __('Sidebar Widgets','wpmix'), | |
'id' => 'wpmix_sidebar-widgets', | |
'description' => __('These are widgets for the sidebar.', 'wpmix'), | |
'before_widget' => '<div id="%1$s" class="the-widget %2$s col-md-4">', | |
'after_widget' => '</div>', |
This file contains 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
<?php | |
//========== Filter Search result ========== | |
function wpmix_search_filter($query) { | |
/* if ($query->is_search) { | |
$query->set('post_type', array('post')); | |
} */ | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'wpmix_search_filter' ); |