Skip to content

Instantly share code, notes, and snippets.

View larbous's full-sized avatar

Luiz Sobral larbous

View GitHub Profile
@escopecz
escopecz / commands.php
Last active April 18, 2023 22:43 — forked from alanhartless/cron.php
Script to run Mautic (https://mautic.org) commands from a URL.
<?php
if (!isset($_GET['ILoveMauticReallyIDo'])) {
echo 'The secret phrase is wrong.';
die;
}
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$allowedTasks = array(
'cache:clear',
@neilgee
neilgee / less-fields-virtual.php
Last active March 10, 2022 00:36
WooCommerce Remove Address Fields from checkout based on presence of virtual products in cart
<?php
add_filter( 'woocommerce_checkout_fields' , 'virtual_products_less_fields' );
/**
* WooCommerce Remove Address Fields from checkout based on presence of virtual products in cart
* @link https://www.skyverge.com/blog/checking-woocommerce-cart-contains-product-category/
* @link https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
* @link https://businessbloomer.com/woocommerce-hide-checkout-billing-fields-if-virtual-product-cart/
*/
@constructyourself
constructyourself / woocommerce-add-to-cart-direct-checkout.php
Created October 5, 2015 06:14
WooCommerce - add product and show checkout
<?
/*
Wordpress + WooCommerce
Add product directly to cart and take user to Checkout page
Instructions:
- add all php code within comment block below to active Wordpress theme file: functions.php
- use URL structure: http://your-site.com/?add-to-cart=37 WHERE 37 is the ID of your WooCommerce Product
*/
@gokulkrishh
gokulkrishh / media-query.css
Last active March 18, 2025 03:44
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@alokstha1
alokstha1 / programmatic_login.php
Created July 7, 2016 16:04
programmatic_login
/**
* Programmatically logs a user in
*
* @param string $username
* @return bool True if the login was successful; false if it wasn't
*/
function programmatic_login( $username ) {
if ( is_user_logged_in() ) {
wp_logout();
@fjcunha
fjcunha / Validate_cpf_cnpj
Created September 27, 2016 15:41
jQuery validator methods to validate cpf and cnpj
jQuery.validator.addMethod("cnpj", function (value, element) {
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
if (value.length == 0) {
return false;
}
value = value.replace(/\D+/g, '');
digitos_iguais = 1;
/**
* @Title: WooCommerce Display Price and Add to Cart button for specific user role only from Shop and Single Product pages
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
if(is_user_logged_in() )
{
$current_user = wp_get_current_user();
foreach ( $current_user->roles as $role )
{
@gstricklind
gstricklind / styles.css
Created December 10, 2016 18:39
Tabbed WooCommerce My Account
body.woocommerce-account .woocommerce-MyAccount-navigation ul {
margin: 0;
}
body.woocommerce-account .woocommerce-MyAccount-navigation ul li {
list-style: none;
}
body.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
text-decoration: none;
}
@ivanvermeyen
ivanvermeyen / !NOTE.md
Last active March 15, 2023 05:25
Setup a Laravel Storage driver with Google Drive API
@ChgoChad
ChgoChad / commands.php
Last active January 5, 2024 22:18 — forked from escopecz/commands.php
Script to run Mautic (https://mautic.org) commands from a URL.
<?php
if (!isset($_GET['ILoveMautic'])) {
echo 'The secret phrase is wrong.';
die;
}
$link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$allowedTasks = array(
'cache:clear',