Skip to content

Instantly share code, notes, and snippets.

Avatar

DavidPeralvarez

View GitHub Profile
@DavidPeralvarez
DavidPeralvarez / gulpfile.js
Created Nov 6, 2018
Temas de WordPress + Gulp + Browsersync
View gulpfile.js
/*
- Compilar código LESS
- Añadir vendor prefixes
- Minificar código CSS resultante
- Observar los archivos para ejecutar las tareas de forma automática
- Recargar automáticamente el navegador
*/
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
@DavidPeralvarez
DavidPeralvarez / style.css
Last active Sep 24, 2018
Cómo insertar Font Awesome v5 en WordPress
View style.css
/* estilos generales */
.icon::before {
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
}
/* estilos de la versión 5, mostrando el icono de facebook */
@DavidPeralvarez
DavidPeralvarez / functions.php
Created Sep 15, 2018
Cómo desactivar los comentarios en un Custom Post Type
View functions.php
/**
* Remove comments support from posts.
*/
add_action( 'init', 'scv_remove_comments_from_posts', 10 );
function scv_remove_comments_from_posts() {
remove_post_type_support( 'post', 'comments' );
}
@DavidPeralvarez
DavidPeralvarez / functions.php
Created Sep 13, 2018
Cómo insertar un CTA dentro de las entradas automáticamente
View functions.php
<?php
/* CTA en el contenido */
add_filter( 'the_content', 'scv_cta_code' );
function scv_cta_code( $content ){
// Definimos nuestro CTA
$codeCTA = '
@DavidPeralvarez
DavidPeralvarez / core-blocks.txt
Last active Nov 6, 2020
Gutenberg core blocks list
View core-blocks.txt
// Útil para filtros de Gutenberg como "allowed_block_types"
archives
audio
button
categories
code
column
columns
coverImage
View lessons-reply-notification.php
<?php
/*
Plugin Name: Lesson Reply Notification
Description: Send and email to the student, when he receives a response
Author: David Perálvarez
Version: 1.0
Author URI: https://silicodevalley.com
*/
apply_filters( 'wp_mail_from', 'david@silicodevalley.com' );
@DavidPeralvarez
DavidPeralvarez / mp_cf7_custom_shortcode.php
Created Jun 13, 2018
MemberPerks mp_cf7_custom_shortcode completa
View mp_cf7_custom_shortcode.php
<?php
// Add custom shortcodes to Contact Form 7 WP plugin
add_action( 'wpcf7_init', 'mp_cf7_custom_shortcode' );
function mp_cf7_custom_shortcode(){
wpcf7_add_form_tag( 'show_member_level', 'cf7_get_member_level' );
}
function cf7_get_member_level(){
$memberLevel = mp_get_member_level();
@DavidPeralvarez
DavidPeralvarez / mp_cf7_custom_shortcode.php
Created Jun 13, 2018
MemberPerks mp_cf7_custom_shortcode parcial
View mp_cf7_custom_shortcode.php
<?php
// Add custom shortcodes to Contact Form 7 WP plugin
add_action( 'wpcf7_init', 'mp_cf7_custom_shortcode' );
function mp_cf7_custom_shortcode(){
// code
}
@DavidPeralvarez
DavidPeralvarez / mp_get_member_level.php
Last active Jun 13, 2018
MemberPerks mp_get_member_level
View mp_get_member_level.php
<?php
// Function to get the member level
function mp_get_member_level(){
// Get current user's ID
$memberID = get_current_user_id();
if( $memberID != 0 ):
// Get member's info
@DavidPeralvarez
DavidPeralvarez / memberperks.php
Created Jun 4, 2018
Cómo obtener datos de un usuario de WordPress
View memberperks.php
<?php
/*
Plugin Name: MemberPerks
Description: Ofrece beneficios a tus usuarios más leales
Author: David Perálvarez
Version: 1.0.0
Author URI: https://silicodevalley.com
*/
// Create the shortcode
You can’t perform that action at this time.