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
<?php | |
namespace App\Helpers; | |
class ColorHelper | |
{ | |
// This function tell you if a color is dark or light. | |
// It is useful when you want to change the text color to white or black depending on the background color. | |
public static function isColorDark($hexColor = '#ffffff') { |
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
--paletteColor1 -----> --theme-palette-color-1 | |
--paletteColor2 -----> --theme-palette-color-2 | |
--paletteColor3 -----> --theme-palette-color-3 | |
--paletteColor4 -----> --theme-palette-color-4 | |
--paletteColor5 -----> --theme-palette-color-5 | |
--paletteColor6 -----> --theme-palette-color-6 | |
--paletteColor7 -----> --theme-palette-color-7 | |
--paletteColor8 -----> --theme-palette-color-8 | |
--fontFamily -----> --theme-font-family |
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
sudo chmod -R 775 /home/milton/www/projects/system* && mkdir wp-content/plugins | |
curl -L https://downloads.wordpress.org/plugin/wp-super-cache.1.7.2.zip -o /tmp/wp-super-cache.1.7.2.zip | |
curl -L https://downloads.wordpress.org/plugin/advanced-custom-fields.5.9.5.zip -o /tmp/advanced-custom-fields.5.9.5.zip && unzip /tmp/advanced-custom-fields.5.9.5.zip -d ./wp-content/plugins | |
curl -L https://downloads.wordpress.org/plugin/custom-post-type-ui.1.8.2.zip -o /tmp/custom-post-type-ui.1.8.2.zip && unzip /tmp/custom-post-type-ui.1.8.2.zip -d ./wp-content/plugins | |
curl -L https://downloads.wordpress.org/plugin/learnpress.zip -o /tmp/learnpress.zip && unzip /tmp/learnpress.zip -d ./wp-content/plugins | |
curl -L https://downloads.wordpress.org/plugin/shins-pageload-magic.zip -o /tmp/shins-pageload-magic.zip && unzip /tmp/shins-pageload-magic.zip -d ./wp-content/plugins | |
curl -L https://downloads.wordpress.org/plugin/wordpress-seo.16.0.0.zip -o /tmp/wordpress-seo.16.0.0.zip && unzip /tmp/wordpress-seo.16.0.0.zip -d ./wp-conten |
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
/* 1. Adds a custom field. NB. I am using some Norwegian words in the below text. | |
* 2. Then adds a validate error message if person does not fill out the field. | |
* 3. Then adds the custom field to the order page. | |
https://businessbloomer.com/woocommerce-add-custom-checkout-field-php/ | |
https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/ | |
https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-6 | |
*/ | |
add_action( 'woocommerce_before_order_notes', 'my_custom_checkout_field' ); | |
function my_custom_checkout_field( $checkout ) { |
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
#!/usr/bin/env bash | |
# Author Mike https://guides.wp-bullet.com | |
# Purpose - Convert MyISAM tables to InnoDB with WP-CLI | |
# create array of MyISAM tables | |
WPTABLES=($(wp db query "SHOW TABLE STATUS WHERE Engine = 'MyISAM'" --silent --skip-column-names | awk '{ print $1}')) | |
# loop through array and alter tables | |
for WPTABLE in ${WPTABLES[@]} | |
do |
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
#!/usr/bin/env bash | |
# for debug output, uncomment: | |
#set -x | |
function help { | |
echo "WordPress cleanup -v 0.5 2018-06-26 / [email protected] | |
Usage: |
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
/** | |
* Automatically add product to cart on visit | |
*/ | |
add_action( 'template_redirect', 'add_product_to_cart' ); | |
function add_product_to_cart() { | |
if ( ! is_admin() ) { | |
$product_id = 64; //replace with your own product id | |
$found = false; | |
//check if product already in cart | |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) { |
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
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Remove Yoast SEO Change existing title or meta template variable | |
* Credit: Moshe Harush | |
* https://stackoverflow.com/questions/36281915/yoast-seo-how-to-create-custom-variables | |
* Last Tested: Unknown | |
*/ | |
// define the wpseo_replacements callback | |
function filter_wpseo_replacements( $replacements ) { |
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
<?php | |
/** | |
* Copy from here to your (child) themes functions.php | |
* Recommended to do so via FTP. | |
*/ | |
/** | |
* Hide all but the free shipping options when free is available. | |
* |
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
<?php | |
// Display variations dropdowns on shop page for variable products | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' ); | |
function woo_display_variation_dropdown_on_shop_page() { | |
global $product; | |
if( $product->is_type( 'variable' )) { | |
NewerOlder