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 | |
add_action( 'woocommerce_cart_coupon', 'lpb_woocommerce_empty_cart_button' ); | |
function lpb_woocommerce_empty_cart_button () { | |
$cart_url = add_query_arg( 'empty_cart', 'yes', wc_get_cart_url() ); | |
$label = 'Empty cart'; | |
echo '<a href="' . esc_url( $cart_url ) . '" class="button">' . $label . '</a>'; | |
} | |
add_action( 'wp_loaded', 'lpb_woocommerce_empty_cart_action', 20 ); |
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 | |
// credits: https://github.com/woocommerce/woocommerce/issues/17487#issuecomment-565433819 | |
add_action( 'woocommerce_product_duplicate', function ( $duplicate, $product ) { | |
$taxonomies = [ 'taxonomy1', 'taxonomy2' ]; | |
foreach ( $taxonomies as $taxonomy ) { | |
$terms = get_the_terms( $product->get_id(), $taxonomy ); | |
if ( ! is_wp_error( $terms ) ) { | |
wp_set_object_terms( $duplicate->get_id(), wp_list_pluck( $terms, 'term_id' ), $taxonomy ); | |
} |
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 | |
// credits: https://github.com/woocommerce/woocommerce/issues/17487#issuecomment-565433819 | |
add_action( 'woocommerce_product_duplicate', function ( $duplicate, $product ) { | |
$taxonomies = [ 'taxonomy1', 'taxonomy2' ]; | |
foreach ( $taxonomies as $taxonomy ) { | |
$terms = get_the_terms( $product->get_id(), $taxonomy ); | |
if ( ! is_wp_error( $terms ) ) { | |
wp_set_object_terms( $duplicate->get_id(), wp_list_pluck( $terms, 'term_id' ), $taxonomy ); | |
} |
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
# Check your website headers here: https://www.serpworx.com/check-security-headers/ or https://gf.dev/ | |
# This configuration works for WP, WC on LiteSpeed server. Be careful. Test site after installing. All lines are explained are in serpworx.com tester. | |
# More docs: | |
# https://www.netsparker.com/whitepaper-http-security-headers/#XFrameOptionsHTTPHeader | |
# https://owasp.org/www-project-secure-headers/ | |
# https://www.keycdn.com/blog/http-security-headers | |
# WordPress plugin for Headers setup https://wordpress.org/plugins/http-headers/ | |
# Main security options in .htaccess file: |
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 | |
/** | |
* Set sizes attribute for responsive images and better performance | |
* | |
* @param array $attr markup attributes. | |
* @param object $attachment WP_Post image attachment post. | |
* @param string|array $size named image size or array. | |
* @return array markup attributes | |
*/ |
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
/* | |
Image Radio for Contact form 7 | |
=============================*/ | |
.pf4_form_image_fields{ | |
display:flex; | |
flex-wrap:wrap; | |
margin-left: -20px; | |
margin-right: -20px; | |
} | |
.pf4_form_image_field{ |
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 | |
// have to add that opening tag to get syntax highlighting... ¯\_(ツ)_/¯ | |
/** | |
* Prevent update notification for plugin | |
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/ | |
* Place in theme functions.php or at bottom of wp-config.php | |
*/ | |
function disable_plugin_updates( $value ) { |
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 | |
// Let’s instantiate this class in our functions.php file: | |
if( is_admin() ) { | |
require 'simple_settings_page.php'; | |
new simple_settings_page(); | |
} |
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 | |
add_action( 'woocommerce_single_product_summary', 'woocommerce_total_product_price', 31 ); | |
function woocommerce_total_product_price() { | |
global $woocommerce, $product; | |
// let's setup our divs | |
echo sprintf('<div id="product_total_price" style="margin-bottom:20px;display:none">%s %s</div>','Total do Produto','<span class="price">'.$product->get_price().'</span>'); | |
echo sprintf('<div id="cart_total_price" style="margin-bottom:20px;display:none">%s %s</div>','Total do Carrinho','<span class="price">'.$product->get_price().'</span>'); | |
?> | |
<script> | |
jQuery(function($){ |
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 | |
//Inserir Informacoes no Header - Isso você coloca no functions.php ;) | |
add_action( 'wp_head', 'InformacoesDoHeader', 1 ); | |
function InformacoesDoHeader () { ?> | |
Aqui você coloca as informações que precisa adicionar header do seu site. Meta, Css.... | |
<?php } ?> |
NewerOlder