quién soy - massciencequién soy natalia díaz de tudanca @natiaz. los temas de wordpress. 1.crear...

Post on 17-Jun-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Quién soy

Natalia Díaz de Tudanca@Natiaz

Los temas de WordPress

1.Crear un tema desde cero

2.Modificar un tema usando un tema hijo

Creando un tema desde 0

1.Normas de desarrollo a.PHP bien estructurado b.HTML c.CSS

2.Archivos mínimos

Sistema de plantillas

style.css

/* Theme Name: Twenty Nineteen Theme URI: https://github.com/WordPress/twentynineteen Author: the WordPress team Author URI: https://wordpress.org/ Description: Our 2019 default theme is designed to show off the power of the block editor. It features custom styles for all the default blocks, and is built so that what you see in the editor looks like what you'll see on your website. Twenty Nineteen is designed to be adaptable to a wide range of websites, whether you’re running a photo blog, launching a new business, or supporting a non-profit. Featuring ample whitespace and modern sans-serif headlines paired with classic serif body text, it's built to be beautiful on all screen sizes. Requires at least: WordPress 4.9.6 Version: 1.2 License: GNU General Public License v2 or later License URI: LICENSE Text Domain: twentynineteen Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready */

• index.php

• home.php

• front-page.php

• header.php

• footer.php

• page.php

• category.php --> category-{slug}.php ó category-{id}.php

• single.php --> single-{posttype}.php

• author.php --> author-{nicename}.php ó author-{id}.php

• archive.php --> archive-{posttype}.php

• tag.php --> tag-{slug}.php ó tag-{id}.php

• taxonomy.php --> taxonomy-{taxonomy-term}.php ó taxonomy-{taxonomy}.php

• date.php

• search.php

• searchform.php

• 404.php

• comments.php

• sidebar.php

• functions.php

• screenshot.png

Archivo functions.php

/** * Theme setup and custom functions. */ require dirname(__FILE__) . '/includes/theme-functions.php';

/** * Enqueue scripts and styles. */ require dirname(__FILE__) .'/includes/enqueue.php';

/** * Load functions to secure your WP install. */ require dirname(__FILE__) .'/includes/security.php';

/** * Load extra functions. */ require dirname(__FILE__) .'/includes/extras.php';

Plantillas personalizadas<?php /* Template Name: Página de contacto */ ?>

El loop

<?php if ( have_posts() ) {

while ( have_posts() ) { the_post(); get_template_part( 'template-parts/content/content' ); }

} else { get_template_part( 'template-parts/content/content', 'none' );

} ?>

Tema hijo¿Por qué crear un tema hijo?

Cómo lo creamos• Crear una carpeta dentro de themes: twentynineteen-child

• Añadir un archivo style.css/* Theme Name: Twenty Nineteen Child Theme URI: http://midominio.com/twenty-nineteen-child/ Description: Twenty Nineteen Child Theme Author: Natiaz Author URI: http://midominio.com Template: twentynineteen 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-nineteen-child */ /* =Aquí empieza la personalización de tu tema -------------------------------------------------------------- */

• @import no debe utilizarse para importares tema padre.

• El método correcto es utilizar wp_enqueue_style ()

wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

wp_enqueue_style( 'child', get_stylesheet_directory_uri() . ‘/style.css’, array( 'parent-style' ) );

• El functions.php de un tema hijo se carga justo antes del tema padre

if ( ! function_exists(‘parent_function') ) { function parent_function() {

} }

Muchas gracias ¿preguntas?

top related