WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como...
Transcript of WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como...
![Page 1: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/1.jpg)
WordPress Custom Post TypesUna buena forma de darle a tu contenido el espacio que
se merece.
![Page 2: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/2.jpg)
Jesus Garcia-Parrado
Alameda
Mi propósito es ayudarte para que tu negocio bril le en internet y se mantenga en el tiempo.
![Page 3: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/3.jpg)
![Page 4: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/4.jpg)
Qué os quiero contar hoy
• Qué son los Custom Post Types en WordPress.
• Qué utilidades tienen.
• Varios casos prácticos.
![Page 5: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/5.jpg)
Tipos de Posts por defecto en WordPress
• Post (Post Type: 'post')
• Page (Post Type: 'page')
• Attachment (Post Type: 'attachment')
• Revision (Post Type: ‘revision')
• Custom CSS (Post Type: 'custom_css')
• Changesets (Post Type: 'customize_changeset')
![Page 6: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/6.jpg)
Tipos de Posts por defecto en WordPress
• Post (Post Type: 'post')
• Page (Post Type: 'page')
• Attachment (Post Type: 'attachment')
• Revision (Post Type: ‘revision')
• Custom CSS (Post Type: 'custom_css')
• Changesets (Post Type: 'customize_changeset')
![Page 7: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/7.jpg)
Un Ejemplo
![Page 8: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/8.jpg)
Custom Post Types• Pueden funcionar como posts o como páginas
• Los podemos organizar por categorías, etiquetas o taxonomías personalizadas.
• Tienen una página indice aparte y pueden tener una plantilla personalizada para la página índice.
• Pueden tener todas, ninguna o cualquier combinación de la funcionalidad por defecto para los posts.
• Podemos recuperar estas entradas desde cualquier lugar utilizando un loop personalizado.
![Page 9: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/9.jpg)
¿Cómo se implementa un custom post type?
Mediante un Plugin
• Es la solución mas utilizada.
• Lo puedes utilizar con cualquier theme (plantilla).
• Lo puedes activar y desactivar independientemente del resto de funcionalidad.
![Page 10: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/10.jpg)
¿Cómo se implementa un custom post type?
Mediante un Theme
• En implementaciones personalizadas.
• El contenido depende del theme.
• Permiten construir funcionalidad avanzada.
![Page 11: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/11.jpg)
PluginEsta es la función que utilizaremos para dar de alta nuestro custom post type:
<?php register_post_type( $post_type, $args ); ?>
https://codex.wordpress.org/Function_Reference/register_post_type
En está página podéis encontrar toda la información y un ejemplo completo.
![Page 12: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/12.jpg)
Fichero Plugin
![Page 13: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/13.jpg)
Plugin<?php/** * Plugin Name: Lux Courses * Plugin URI: http://luxdesignworks.com * Description: Custom post type to store and handle Lux courses. * Version: 1.0.0 * Author: Jesus Garcia-Parrado Alameda * Author URI: http://luxdesignworks.com * License: GPL3 + */
![Page 14: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/14.jpg)
Plugin/* Copyright 2016 Jesus Garcia-Parrado Alameda
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA*/
![Page 15: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/15.jpg)
Pluginfunction lux_course_init() { $labels = array( 'name' => _x( 'Courses', 'post type general name', 'your-plugin-textdomain' ), 'singular_name' => _x( 'Course', 'post type singular name', 'your-plugin-textdomain' ), 'menu_name' => _x( 'Courses', 'admin menu', 'your-plugin-textdomain' ), 'name_admin_bar' => _x( 'Course', 'add new on admin bar', 'your-plugin-textdomain' ), 'add_new' => _x( 'Add New', 'course', 'your-plugin-textdomain' ), 'add_new_item' => __( 'Add New Course', 'your-plugin-textdomain' ), 'new_item' => __( 'New Course', 'your-plugin-textdomain' ), 'edit_item' => __( 'Edit Course', 'your-plugin-textdomain' ), 'view_item' => __( 'View Course', 'your-plugin-textdomain' ), 'all_items' => __( 'All Courses', 'your-plugin-textdomain' ), 'search_items' => __( 'Search Courses', 'your-plugin-textdomain' ), 'parent_item_colon' => __( 'Parent Courses:', 'your-plugin-textdomain' ), 'not_found' => __( 'No courses found.', 'your-plugin-textdomain' ), 'not_found_in_trash' => __( 'No courses found in Trash.', 'your-plugin-textdomain' ) );
![Page 16: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/16.jpg)
Plugin $args = array( 'labels' => $labels, 'description' => __( 'Description.', 'your-plugin-textdomain' ), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_icon' => 'dashicons-welcome-learn-more', 'query_var' => true, 'rewrite' => array( 'slug' => 'course' ), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => 5, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ), 'taxonomies' => array('category','post_tag') );
register_post_type( 'course', $args );}add_action( 'init', 'lux_course_init' );
![Page 17: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/17.jpg)
Pluginfunction lux_rewrite_flush() { lux_course_init(); flush_rewrite_rules();}register_activation_hook( __FILE__, 'lux_rewrite_flush' );}add_action( 'init', 'lux_course_init' );
![Page 18: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/18.jpg)
Lux Courses Custom Post Type Plugin
![Page 19: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/19.jpg)
Lux Courses Custom Post Type
![Page 20: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/20.jpg)
Nuevo Lux Course
![Page 21: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/21.jpg)
Nuevo Lux Course
![Page 22: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/22.jpg)
Indice Lux Courses
![Page 23: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/23.jpg)
Lux Course
![Page 24: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/24.jpg)
Cursos Afectiva
![Page 25: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/25.jpg)
Cursos Afectiva
![Page 26: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/26.jpg)
Cursos Afectiva
![Page 27: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/27.jpg)
Cursos Afectiva
![Page 28: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/28.jpg)
Plugin Relacionado
![Page 29: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/29.jpg)
Informes AGEPEM
![Page 30: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/30.jpg)
Informes AGEPEM
![Page 31: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/31.jpg)
Plugin Relacionado
![Page 32: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/32.jpg)
Plugin Relacionado
![Page 33: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/33.jpg)
Portfolio Lux
![Page 34: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/34.jpg)
!Gracias por vuestra
atención¡
@gpjalameda en Twitter
Lux Design Works & Love Your Website
![Page 35: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/35.jpg)
¡Gracias!
![Page 36: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/36.jpg)
Agradecimientos
@WPMajadahonda @CowUpCo @HoyStreaming @hostfusion
![Page 37: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/37.jpg)
¿Preguntas?
![Page 38: WP Custom Post Types - Servicio video streaming · Custom Post Types • Pueden funcionar como posts o como páginas • Los podemos organizar por categorías, etiquetas o taxonomías](https://reader033.fdocuments.in/reader033/viewer/2022052101/603b186fa4c6a323f03a10c6/html5/thumbnails/38.jpg)
Lux Design Works& Love Your Website