Skip to content

Instantly share code, notes, and snippets.

View pagelab's full-sized avatar
🚀

Márcio Duarte pagelab

🚀
View GitHub Profile
@pagelab
pagelab / how-not-to-use-wp-filter.php
Created January 6, 2020 18:07 — forked from damiencarbery/how-not-to-use-wp-filter.php
Use $wp_filter global to view functions attached to actions and filters
<?php
/*
Plugin Name: wp_filter functions
Plugin URI: http://www.damiencarbery.com/2017/06/list-functions-attached-to-an-action/
Description: List functions attached to all actions and filters. DON'T DO IT!
Author: Damien Carbery
Version: 0.1
*/
add_action( 'wp_head', 'wp_filter_the_wrong_way' );
@pagelab
pagelab / Alternativas ao Zapier.txt
Created October 21, 2019 20:27
Alternativas ao Zapier
Workato
Apiant
Inegromat
Snaplogic
CloudHQ
Boomi
Tibco
Jitterbit
AWS Lambda
Mulesoft
<?php
/**
* Plugin Name: Conditional WooCommerce Checkout Fields
* Description: Adds the abilitiy to conditionally show / hide checkout fields.
* Version: 1.0
* Author: Caleb Burks
* Author URI: http://calebburks.com
*/
@pagelab
pagelab / skip-to-check-out.php
Created October 8, 2019 21:13 — forked from micc83/skip-to-check-out.php
Skip cart and redirect to direct checkout on WooCommerce
<?php
/**
* Skip cart and redirect to direct checkout
*
* @package WooCommerce
* @version 1.0.0
* @author Alessandro Benoit
*/
// Skip the cart and redirect to check out url when clicking on Add to cart
@pagelab
pagelab / woocommerce-ajax-checkout-spinner.css
Created October 8, 2019 13:10 — forked from eversionsystems/woocommerce-ajax-checkout-spinner.css
WooCommerce Change AJAX Spinner Gif On Checkout
/*
* Custom AJAX spinner on WooCommerce checkout
* The class used to load the overlay is .blockUI .blockOverlay
* The class used to load the spinner is .woocommerce .loader:before
*
*/
.woocommerce .blockUI.blockOverlay:before,.woocommerce .loader:before {
height: 3em;
width: 3em;
position: absolute;
@pagelab
pagelab / functions.php
Created September 19, 2019 18:59
Adicionando um link de login/logout no menu principal do tema.
<?php // Don't add this line if inserting in a functions.php file.
add_filter( 'wp_nav_menu_items', function( $items, $args ) {
// Only used on main menu
if ( 'main_menu' != $args->theme_location ) {
return $items;
}
// Add custom item
@pagelab
pagelab / woocommerce_get_shop_page_permalink.php
Created September 11, 2019 14:41 — forked from jessepearson/woocommerce_get_shop_page_permalink.php
This will turn the shop page permalink into a link for the home page.
@pagelab
pagelab / remove_checkout_fields.php
Created September 5, 2019 20:06 — forked from cryptexvinci/remove_checkout_fields.php
Remove fields from WooCommerce checkout page.
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
function custom_remove_woo_checkout_fields( $fields ) {
// remove billing fields
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
@pagelab
pagelab / woocommerce-optimize-scripts.php
Created September 4, 2019 21:03 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@pagelab
pagelab / functions.php
Created September 4, 2019 12:24 — forked from lukecav/functions.php
Add in a custom prefix and suffix to WooCommerce Order Number
add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number', 1, 2);
function change_woocommerce_order_number( $order_id, $order ) {
$prefix = '#SAM-';
$suffix = '-' . date(Y);
return $prefix . $order->id . $suffix;
}