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 | |
/* | |
Create a shortcode that will wrap content, and will return a product link | |
based on the product ID that is added to the shortcode | |
Usage: [stock_product_link id="123"]The text, image, etc. you want to link[/stock_product_link] | |
*/ | |
if( !function_exists('custom_shortcode_stock_product_link') ) { | |
function custom_shortcode_stock_product_link( $atts, $content = null ) { | |
// Shortcode Attributes |
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 | |
// let's add a CUSTOM IMAGE SIZE that can be used for featured product images within the emails | |
add_action( 'after_setup_theme', 'add_email_featured_img_size' ); | |
function add_email_featured_img_size() { | |
add_image_size( 'email-featured-thumb', 130, 130, true ); // (cropped) | |
} | |
// add custom content to END OF EMAIL | |
add_action( 'woocommerce_email_footer', 'add_footer_content'); |
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
(function($) { | |
$(window).on('scroll', function() { | |
if(jQuery('#main-header').hasClass("et-fixed-header")) { | |
jQuery('#logo').attr('src','/wp-content/uploads/logo-alt.png'); | |
} | |
else { | |
jQuery('#logo').attr('src','/wp-content/uploads/logo.png'); | |
} | |
}); | |
})( jQuery ); |
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 custom Local taxonomies | |
* This basically lets you create Categories for Pages (similar to what you can do for Posts) | |
* | |
* Additional custom taxonomies can be defined here | |
* http://codex.wordpress.org/Function_Reference/register_taxonomy | |
*/ | |
function fs_add_local_page_taxonomies() { |
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 | |
/* Usage: | |
[fs-local-type type="wordpress"] | |
You can add additional parameters to the shortcode to override settings | |
Note: "local-type" is the name of the Taxonomy, and "wordpress" is the name of one of the terms | |
*/ | |
// create shortcode to list all Local Types | |
add_shortcode( 'fs-local-type', 'fs_local_type_shortcode' ); |
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 abc_search( $query ) { | |
if( $query->is_search && !is_admin() ) { | |
$query->set( 'orderby', 'title' ); | |
$query->set( 'order', 'ASC' ); | |
} | |
} | |
add_filter( 'pre_get_posts','abc_search' ); |
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 an automatic default custom taxonomy for custom post type. | |
* If no taxonomy term is selected during post creation, the custom post will be assigned the specififed taxonomy terms during save. | |
* Just change the 'your-cpt-type' to your custom post type name | |
* and change 'fruit_tags' and 'soda_flavors' to the taxonomy slug(s) you want to target | |
* and change 'apple' and 'banana' and 'cola' with the slug(s) of the term(s) you want to make default | |
* you can add multiple taxonomy at once so the 'soda_flavors' line is applicable only then | |
*/ |
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 | |
// Removes et_add_viewport_meta from the wp_head phase | |
function remove_divi_actions() { | |
remove_action( 'wp_head', 'et_add_viewport_meta' ); | |
} | |
// Call 'remove_divi_actions' during WP initialization | |
add_action('init','remove_divi_actions'); | |
// add ability to pinch and zoom |
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 Shortcode [cart_count] | |
function get_cart_count() { | |
//Check if WooCommerce is active | |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
global $woocommerce; | |
$cart_url = $woocommerce->cart->get_cart_url(); | |
$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) ); | |
$cart_contents_count = $woocommerce->cart->cart_contents_count; |
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 more font weights | |
add_filter('et_builder_google_fonts', 'my_custom_google_fonts', 10); | |
function my_custom_google_fonts($google_fonts) { | |
$google_fonts['Montserrat']['styles'] = '300,300i,400,400i,600,600i,700,700i'; | |
return $google_fonts; | |
} |