Skip to content

Instantly share code, notes, and snippets.

Alvaro Gómez Velasco mrfoxtalbot

Block or report user

Report or block mrfoxtalbot

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
@mrfoxtalbot
mrfoxtalbot / woocommerce-custom-login-redirect.php
Created May 30, 2019
Role based Custom Redirects for WooCommerce login
View woocommerce-custom-login-redirect.php
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
View gist:6e15323b00866301472929fda32a11c3
function mrfx_remove_post_dates() {
add_filter('the_date', '__return_false');
add_filter('the_time', '__return_false');
add_filter('the_modified_date', '__return_false');
add_filter('get_the_date', '__return_false');
add_filter('get_the_time', '__return_false');
add_filter('get_the_modified_date', '__return_false');
}
add_action('loop_start', 'mrfx_remove_post_dates');
@mrfoxtalbot
mrfoxtalbot / WordPress -User-Agent-Body-Classes.php
Created Aug 6, 2018
WordPress User Agent Body Classes (via Weiko)
View WordPress -User-Agent-Body-Classes.php
<?php function rves3_body_classes( $classes ) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
elseif($is_IE) {
$classes[] = 'ie';
View gist:cb2509d47edc16847b0017e81010ef96
<h1 style="text-align: center;"><span style="color: #334cbd;"><strong><span style="font-family: arial, helvetica, sans-serif; font-size: 24pt;"> ALGUNOS CASOS DE ÉXITO</span></strong></span></h1>
<hr />
<p style="text-align: center;"><span style="font-size: 12pt; color: #000000;">En <em><strong>Solución Solar &amp; Led</strong> </em>Hemos desarrollado más de 100 proyectos en todo Colombia</span></p>
&nbsp;
<p style="text-align: center;">[one-fourth-first]<span style="font-size: 12pt; font-family: arial, helvetica, sans-serif; color: #000000;">Las energías renovables son el futuro energético de nuestro país, y desde ya nosotros contribuimos con el cambio, este año gracias a nuestros proyectos en funcionamiento se evitara la emisión de 32.500 toneladas de CO2 durante 25 Años promedio. Conoce cuánto ahorran nuestros clientes. </span>[/one-fourth-first]
[one-fourth]<span style="color: #000000; font-family: 'andale mono', monospace;">[wonderplugin_slider id="3"]</span>[/one-fourth]
[one-fourth]<span style="colo
@mrfoxtalbot
mrfoxtalbot / RGPD-template-spanish.html
Last active May 25, 2018
Plantilla para crear una documento de protección de datos RGPD basado en el de Ayuda WordPress
View RGPD-template-spanish.html
hola
<p><tt>Última actualización: $FECHAACTUALIZACION</tt></p>
<h2><u>TITULAR DE LA WEB</u></h2>
<ul>
<li>Su denominación social es: $NOMBREDELAEMPRESA</li>
<li>Su CIF: $ELCIF</li>
<li>Su domicilio social es: $DIRECCIONDELAEMPRESA</li>
<li>Su actividad social es: $ACTIVIDADDELAWEB</li>
<li>Correo electrónico: $EMAILDECONTACTO</li>
@mrfoxtalbot
mrfoxtalbot / createuser.php
Created May 3, 2018
Generate a new WordPress user via FTP
View createuser.php
<?php function wpb_admin_account(){
$user = 'your-username';
$pass = 'your-password';
$email = 'name@domain.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }
add_action('init','wpb_admin_account'); ?>
@mrfoxtalbot
mrfoxtalbot / acf-custom-taxonomy-terms-icons.php
Last active Mar 16, 2018
Use ACF to list term icons/images in a custom WordPress taxonomy
View acf-custom-taxonomy-terms-icons.php
<?php
// load all 'category' terms for the post
$terms = get_the_terms( get_the_ID(), 'nombre_taxonomia');
foreach ( $terms as $term ) {
echo ' <div class="tax-icons">';
// we will use the first term to load ACF data from
if( !empty($terms) ) {
$term = array_pop($terms);
$custom_field = get_field('nombre_campo_icono', $term );
echo '<img src="';
View html-redirect.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;URL=../new-page.htm" />
<title>Redirect to... title of new-page</title>
</head>
<body>
<h1>Re-directing...</h1>
<p>You are being re-directed, if nothing happens, please <a href="../new-page.htm">follow this link</a></p>
@mrfoxtalbot
mrfoxtalbot / remove-cf7-css-js.php
Created Feb 12, 2018
Remove Contact Form 7 Scripts and Stlyes
View remove-cf7-css-js.php
<?php
//You can set the value of this constant in your wp-config.php like this:
define('WPCF7_LOAD_JS', false);
//Likewise, you can control the loading of the CSS stylesheet with WPCF7_LOAD_CSS. Contact Form 7 does not load the CSS stylesheet when the value of WPCF7_LOAD_CSS is false (default: true). You can set it in the wp-config.php like this:
define('WPCF7_LOAD_CSS', false);
//Or, you can also disable the loading of the JavaScript and CSS by adding a few lines of code into your theme’s functions.php file, like this:
add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );
@mrfoxtalbot
mrfoxtalbot / redirect-cf7-submissiones-miltiple.php
Created Jan 19, 2018
Redirigir a otra página después de enviar un formlario de Contact Form 7 (distinguir a dónde si tienes varios formularios)
View redirect-cf7-submissiones-miltiple.php
<?php add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '947' == event.detail.contactFormId ) { // Sends sumissions on form 947 to the first thank you page
location = 'https://www.example.com/thank-you-1/';
} else if ( '1070' == event.detail.contactFormId ) { // Sends submissions on form 1070 to the second thank you page
location = 'https://www.example.com/thank-you-2/';
You can’t perform that action at this time.