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 | |
// To change add to cart text on single product page | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'storemizer_single_add_to_cart_text' ); | |
function storemizer_single_add_to_cart_text() { | |
return __( 'Buy Now', 'woocommerce' ); | |
} | |
// To change add to cart text on product archives(Collection) page | |
add_filter( 'woocommerce_product_add_to_cart_text', 'storemizer_product_add_to_cart_text' ); | |
function storemizer_product_add_to_cart_text() { |
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 | |
class ColorPalette{ | |
public $color; | |
public function __construct($color){ | |
$this->color = $color; | |
} | |
public function color_mod($hex, $diff) { | |
$rgb = str_split(trim($hex, '# '), 2); | |
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 | |
/** | |
* Code to Create Custom WordPress login form without plugin | |
* @author Joe Njenga | |
* @ gist - | |
*/ | |
// Step 1: Create shortcode | |
function njengah_add_login_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 | |
/* Redirect user after check out */ | |
add_action( 'template_redirect', 'njengah_custom_redirect_after_purchase' ); | |
function njengah_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { |
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 numeric pagination in WordPress | |
*/ | |
// Get total number of pages | |
global $wp_query; | |
$total = $wp_query->max_num_pages; | |
// Only paginate if we have more than one page |
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 | |
/** | |
* Skip Cart and Redirect to Checkout | |
* Add to functions.php of child theme | |
*/ | |
add_filter('woocommerce_add_to_cart_redirect', 'njengah_skip_cart_redirect_to_checkout_page'); | |
function njengah_skip_cart_redirect_to_checkout_page() { |
NewerOlder