Skip to content

Instantly share code, notes, and snippets.

@DavidPeralvarez
DavidPeralvarez / lessons-reply-notification.php
Last active July 4, 2018 11:46
Lesson Reply Notification
<?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 June 13, 2018 07:49
MemberPerks mp_cf7_custom_shortcode parcial
<?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 June 13, 2018 07:31
MemberPerks mp_get_member_level
<?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 June 4, 2018 10:39
Cómo obtener datos de un usuario de WordPress
<?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
@DavidPeralvarez
DavidPeralvarez / index.php
Last active May 29, 2018 09:17
Mostrar Post Formats dentro del Loop de WordPress
<?php
if ( have_posts() ):
while ( have_posts() ): the_post();
//Mostramos el "slug" del formato de post
echo get_post_format();
endwhile;
endif;
?>
@DavidPeralvarez
DavidPeralvarez / index.php
Last active May 29, 2018 09:00
Mostrar una plantilla según Post Format
<?php
if ( have_posts() ):
while ( have_posts() ): the_post();
//Cargamos una plantilla u otra en función del formato de post
//El primer parámetro que recibe es el nombre del directorio que contiene las plantillas
get_template_part('template-parts', get_post_format());
endwhile;
endif;
?>
@DavidPeralvarez
DavidPeralvarez / functions.php
Last active May 29, 2018 08:40
Añadir soporte a Post Formats en WordPress
<?php
// Damos soporte a los Post Formats: Aside, Link, Image, Video y Quote
add_theme_support( 'post-formats', array( 'aside', 'link', 'image', 'video' , 'quote' ) );
@DavidPeralvarez
DavidPeralvarez / lesson-reply-notification.php
Created May 17, 2018 20:44
Aviso de respuesta a duda por correo
<?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
*/
add_action( 'wp_insert_comment', 'scv_comment_notification', 99, 2 );
<div id="main">
<header></header>
<ul>
<li class="item1"></li>
<li class="item2"></li>
<li class="item3"></li>
</ul>
<footer></footer>
</div>
@DavidPeralvarez
DavidPeralvarez / selectores-descendientes.css
Created March 29, 2018 13:38
(CSS) Selectores descendientes en CSS
body{
background-color: #f2f2f2;
width: 960px;
margin: 0 auto;
}
.post{
background-color: white;
padding: 20px;
}