Skip to content

Instantly share code, notes, and snippets.

View hasti's full-sized avatar

Hastimal Shah hasti

View GitHub Profile
@hasti
hasti / remove-woo-scripts.php
Created May 11, 2020 18:52 — forked from jan-koch/remove-woo-scripts.php
Remove WooCommerce related resources except on WooCommerce-based pages (products, cart, checkout, etc). Use on a testing environment before pasting this into your live website!
/**
* This code snippet removes JavaScript and CSS files loaded from WooCommerce if they are not necessary.
*
* Please test this on a staging copy of your website before putting this into the functions.php of your live website.
*/
add_action( 'wp_enqueue_scripts', 'my_remove_woo_assets', 99 );
function my_remove_woo_assets() {
if ( function_exists( 'is_woocommerce' ) ) { // Check if Woo is installed.
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { // Only run on non-Woo pages.
// Remove unnecessary stylesheets.
@hasti
hasti / functions.php
Last active November 7, 2016 19:05
How to Add Divi Builder to Custom Post Type
<?php
// Adding Divi Builder on Custom Post Type
add_filter( 'et_builder_post_types', 'hs_et_builder_post_types' );
// Use ANY ONE OF THE FUNCTION BELOW
function hs_et_builder_post_types( $post_types ) {
$post_types[] = 'news';
// $post_types[] = 'ANOTHER_CPT_HERE';
return $post_types;
}
@hasti
hasti / search.php
Last active November 1, 2016 22:18
Genesis Framework Child Theme Custom Search Template
<?php
/**
* Author: Hastimal Shah
* Link: http://hastishah.com/
* Email: hasti@hastishah.com
*/
/* If you dont want to use any force layout then please comment line no 10 to 20 */
//* Force content-sidebar layout setting
//add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' ); // Remove // to uncomment the code