Skip to content

Instantly share code, notes, and snippets.

Pablo dos Santos Gonçalves Pacheco pablo-sg-pacheco

Block or report user

Report or block pablo-sg-pacheco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Created Oct 11, 2019 — forked from TimBHowe/functions.php
Forcibly remove the tax line item and calculation from the cart. (suggest just using the GEO setting in WooCommerce)
View functions.php
<?php
// Remove the Tax Line item from the cart.
function wc_remove_cart_tax_totals( $tax_totals, $instance ) {
if( is_cart() ) {
$tax_totals = array();
}
return $tax_totals;
}
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Last active Aug 29, 2019
Wordpress - Password protect a custom post type programmatically
View functions.php
<?php
//Password Protect programmatically
function passwordProtectPosts($post_object) {
//Checks if current post is a specific custom post type
if ($post_object->post_type!='tutorial')) {
return;
}
//Checks if current post is from a specific category
@pablo-sg-pacheco
pablo-sg-pacheco / Settings
Last active Nov 5, 2018
Product Input Fields for WooCommerce - Display fields one above the other
View Settings
<tr><td><div><label for="%field_id%">%title%</label></div>%field%</td></tr>
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Last active Oct 23, 2018
Product Open Pricing (Name Your Price) for WooCommerce - Add to cart programmatically
View functions.php
<?php
add_action('wp_loaded',function(){
if( is_admin() ){
return;
}
$product_id = 161;
$quantity = 1;
$variation_id = 0;
WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, array(), array(
'alg_open_price' => 99
@pablo-sg-pacheco
pablo-sg-pacheco / customize-pif-frontend-position.php
Created Jun 28, 2018
Customizes frontend position of Product Input field plugin
View customize-pif-frontend-position.php
<?php
/*
Plugin Name: Customize Product Input Field Frontend Position
Description: Customizes frontend position of Product Input Field plugin
Version: 1.0.0
Author: Algoritmika Ltd
Author URI: http://algoritmika.com
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Text Domain: customize-pif-frontend-position
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Last active Jun 21, 2018
Replace input field by dropdown using the Product Open Pricing plugin
View functions.php
<?php
// Remove default input
add_filter( 'option_' . 'alg_wc_product_open_pricing_frontend_template', 'popwc_remove_default_input' , 10, 2 );
function popwc_remove_default_input($value){
if(!is_admin()){
$value='';
}
return $value;
}
@pablo-sg-pacheco
pablo-sg-pacheco / index.php
Last active Jun 20, 2018
Add compatibility with WOOF plugin and More Sorting Options for WooCommerce regarding title sorting option
View index.php
<?php
// Add these cases on get_catalog_orderby() function on index.php
case 'title-desc':
$orderby = "title";
$order = 'DESC';
break;
case 'title-asc':
$orderby = "title";
$order = 'ASC';
@pablo-sg-pacheco
pablo-sg-pacheco / style.css
Last active May 8, 2018
Charity Theme - Move the mobile menu icon to center
View style.css
/*
* Move the mobile menu icon to center
*
* Theme Name: HB Charity
* Theme URI: http://hummingbirdthemes.com/themes/hb-charity-wordpress-theme/
*/
.menu .visible-xs{
text-align:center;
}
.menu #showbutton{
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Last active May 8, 2018
Charity Theme - Add content before moving articles on header
View functions.php
add_action( 'hb_charity_top_header', function(){
?>
<div class="topheader" style="color:#fff;">
<div class="container">
<div class="row">
<div class="col-lg-12">
<?php echo __( 'My Articles', 'hb-charity' ); ?>
</div>
</div>
</div>
@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Last active Apr 10, 2018
Make the plugin Wish list for WooCommerce compatible with Yith Infinite scrolling
View functions.php
/**
* Makes the plugin Wish list for WooCommerce compatible with Yith Infinite scrolling
*/
add_action('wp_footer',function(){
?>
<script>
jQuery(document).on('yith_infs_added_elem',function(){
jQuery('.alg-wc-wl-btn').addClass('ajax-loading');
var alg_wc_wl_show = function(){
jQuery('.alg-wc-wl-btn.ajax-loading').removeClass('ajax-loading');
You can’t perform that action at this time.