Skip to content

Instantly share code, notes, and snippets.

Avatar

DavidPeralvarez

View GitHub Profile
@DavidPeralvarez
DavidPeralvarez / index.php
Last active May 29, 2018
Mostrar una plantilla según Post Format
View index.php
<?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 / index.php
Last active May 29, 2018
Mostrar Post Formats dentro del Loop de WordPress
View index.php
<?php
if ( have_posts() ):
while ( have_posts() ): the_post();
//Mostramos el "slug" del formato de post
echo get_post_format();
endwhile;
endif;
?>
@DavidPeralvarez
DavidPeralvarez / functions.php
Last active May 29, 2018
Añadir soporte a Post Formats en WordPress
View functions.php
<?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
Aviso de respuesta a duda por correo
View lesson-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
*/
add_action( 'wp_insert_comment', 'scv_comment_notification', 99, 2 );
@DavidPeralvarez
DavidPeralvarez / front-end-posting.php
Created May 17, 2018
WordPress Plugin Front End Posting
View front-end-posting.php
<?php
/*
Plugin Name: Front End Posting
Description: Create posts from the front end
Author: David Perálvarez
Version: 1.0
Author URI: https://silicodevalley.com
*/
// Front end submission form
@DavidPeralvarez
DavidPeralvarez / functions-fb.php
Created Mar 29, 2018
Imagen destacada de WordPress como Facebook Thumbnail
View functions-fb.php
/**
* Facebook Thumb Fixer
*/
add_action('wp_head','fbfixthumbnail');
function fbfixthumbnail(){
global $post;
//If there is a post image
if (has_post_thumbnail()) {
View emmet.html
<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 Mar 29, 2018
(CSS) Selectores descendientes en CSS
View selectores-descendientes.css
body{
background-color: #f2f2f2;
width: 960px;
margin: 0 auto;
}
.post{
background-color: white;
padding: 20px;
}
@DavidPeralvarez
DavidPeralvarez / selectores-descendientes.html
Created Mar 29, 2018
(HTML) Selectores descendientes en CSS
View selectores-descendientes.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="styles.css">
<title>Selectores descendientes en CSS</title>
</head>
<body>
<header id="main-header">
@DavidPeralvarez
DavidPeralvarez / selectores-id-clase.css
Created Mar 29, 2018
(CSS) Selectores de ID y de CLASE en CSS
View selectores-id-clase.css
header{
text-align: center;
}
#big-title{
font-size: 60px;
margin: 30px 0 0 0;
}
#subtitle{
font-style: italic;
You can’t perform that action at this time.