Skip to content

Instantly share code, notes, and snippets.

@deryckoe
Last active February 17, 2017 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deryckoe/7796b4caa2347c094c7b5ed4027e8ce7 to your computer and use it in GitHub Desktop.
Save deryckoe/7796b4caa2347c094c7b5ed4027e8ce7 to your computer and use it in GitHub Desktop.
WPExpertos/Child Themes
<?php
function wpxp_load_styles() {
// Carga los estilos de este tema hijo
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
// Carga la tipografia Exo de Google
wp_enqueue_style( 'google-exo', 'https://fonts.googleapis.com/css?family=Exo' );
}
// Se ejecuta al cargar los scripts y estilos en WordPress
add_action( 'wp_enqueue_scripts', 'wpxp_load_styles' );
function wpxp_modify_title( $title ) {
return
( 'post' === get_post_type( get_the_ID() ) && in_the_loop() ) // si la entrada es de tipo post y esta en el loop principal
? '<span class="title-icon">&raquo;</span> ' . $title // agrega el icono al inicio del titulo
: $title; // de lo contrario, devuelve el titulo sin modificarlo.
}
// Filtra antes de imprimir cada titulo.
add_filter( 'the_title', 'wpxp_modify_title' );
?>
twentyseventeen-child
- style.css
- functions.php
- screenshot.png // opcional, pero recomendado
<?php require_once( get_stylesheet_directory() . '/file_a_incluir.php' ); ?>
/*
Theme Name: Twenty Seventeen Hijo
Theme URI: http://example.com/twenty-seventeen-child/
Description: Tema hijo para Twenty Seventeen
Author: Deryck de WP Expertos
Author URI: http://wpexpertos.net
Template: twentyseventeen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-seventeen-child
*/
@import "../twentyseventeen/style.css";
@import "https://fonts.googleapis.com/css?family=Exo";
.site-content-contain {
background-color: lightcyan;
}
body .site-title, body.has-header-video .site-title, body.has-header-image .site-title a, body.has-header-video .site-title a {
color: pink;
font-family: 'Exo', sans-serif;
font-size: 40px;
}
.main-navigation a {
text-transform: uppercase;
font-family: 'Exo', sans-serif;
}
.title-icon {
display: inline-block;
border: 2px solid #333;
border-radius: 3px;
padding: 0px 10px;
line-height: 1;
margin-right: 5px;
}
<?php
function wpxp_load_domain() {
load_child_theme_textdomain( 'twenty-seventeen-child', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'wpxp_load_domain' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment