Skip to content

Instantly share code, notes, and snippets.

View claudiosanches's full-sized avatar
👨‍💻

Claudio Sanches claudiosanches

👨‍💻
View GitHub Profile
@claudiosanches
claudiosanches / wc-remove-billing-fields.php
Created January 27, 2016 02:07
WooCommerce - Remove billing address, fone and company fields
<?php
/**
* Plugin Name: WooCommerce Remove billing fields
* Description: Remove billing address, fone and company fields from WooCommerce checkout.
* Author: Claudio Sanches
* Author URI: https://claudiosmweb.com
* Version: 0.0.1
* License: GPLv2 or later
*/
@claudiosanches
claudiosanches / plugin.php
Created January 25, 2016 23:05
WooCommerce - Add Saudi Riyal currency and symbol
<?php
function wc_add_saudi_riyal_currency( $currencies ) {
$currencies['SAR'] = 'Saudi Riyal';
return $currencies;
}
add_filter( 'woocommerce_currencies', 'wc_add_saudi_riyal_currency' );
@claudiosanches
claudiosanches / wp-config.php
Created December 21, 2015 19:53
WordPress - Stop debugging in production
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
@claudiosanches
claudiosanches / functions.php
Last active July 18, 2016 03:15
WooCommerce - Make related posts randomly
<?php
function rand_related_products_query( $query ) {
$query['limits'] = ' ORDER BY RAND() ' . $query['limits'];
return $query;
}
add_filter( 'woocommerce_product_related_posts_query', 'rand_related_products_query' );
@claudiosanches
claudiosanches / pac-gratuito.php
Created November 14, 2015 00:51
Exemplo completo de desenvolvimento de plugin
<?php
/**
* Plugin Name: PAC Gratuito
* Plugin URI: https://claudiosmweb.com/woocommerce/woocommerce-deixar-o-metodo-de-entrega-pac-dos-correios-gratuito/
* Description: Deixa o valor do PAC do WooCommerce Correios sempre como gratuito.
* Author: Claudio Sanches
* Author URI: http://claudiosmweb.com/
* Version: 1.0.0
*/
@claudiosanches
claudiosanches / pac-gratuito.php
Last active November 14, 2015 00:44
Exemplo de desenvolvimento de plugin
<?php
/**
* Plugin Name: PAC Gratuito
* Plugin URI: https://claudiosmweb.com/woocommerce/woocommerce-deixar-o-metodo-de-entrega-pac-dos-correios-gratuito/
* Description: Deixa o valor do PAC do WooCommerce Correios sempre como gratuito.
* Author: Claudio Sanches
* Author URI: http://claudiosmweb.com/
* Version: 1.0.0
*/
@claudiosanches
claudiosanches / functions.php
Last active June 4, 2022 07:52
WooCommerce - Add Order Again button to My Orders actions
<?php
/**
* Add order again button in my orders actions.
*
* @param array $actions
* @param WC_Order $order
* @return array
*/
function cs_add_order_again_to_my_orders_actions( $actions, $order ) {
if ( $order->has_status( 'completed' ) ) {
@claudiosanches
claudiosanches / install.sh
Last active September 3, 2021 15:48
Ubuntu - Install Strem.io
#!/usr/bin/env bash
sudo su
curl -SO# http://178.62.254.47/Stremio3.5.1.linux.tar.gz
mkdir -p /opt/stremio
tar -xvzf Stremio3.5.1.linux.tar.gz -C /opt/stremio
curl -SO# http://www.strem.io/3.0/stremio-white-small.png
mv stremio-white-small.png /opt/stremio/
curl -SO# https://gist.githubusercontent.com/claudiosmweb/797b502bc095dabee606/raw/52ad06b73d90a4ef389a384fbc815066c89798eb/stremio.desktop
mv stremio.desktop /usr/share/applications/
@claudiosanches
claudiosanches / shortcode.txt
Last active October 23, 2015 23:37
WooCommerce Help Scout - Conversation shortcode
[wc_help_scout_form]
@claudiosanches
claudiosanches / 001-install.sh
Last active April 9, 2017 11:45
WordPress - Simple Ubuntu dev bootstrap
# It's dangerous to go alone! Take this
sudo su
# Update
apt-get update
apt-get upgrade
# Install Apache2
apt-get install -y apache2