WordPress Custom Post Types Una buena forma de darle a tu contenido el espacio que se merece.
Jesus Garcia-Parrado Alameda Mi propósito es ayudarte para que tu negocio brille en internet y se mantenga en el tiempo.
Qué os quiero contar hoy Qué son los Custom Post Types en WordPress. Qué utilidades tienen. Varios casos prácticos.
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')
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')
Un Ejemplo
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.
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.
Cómo se implementa un custom post type? Mediante un Theme En implementaciones personalizadas. El contenido depende del theme. Permiten construir funcionalidad avanzada.
Plugin Esta 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.
Fichero Plugin
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 + */
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
Plugin function 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' ) );
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' );
Plugin function lux_rewrite_flush() { lux_course_init(); flush_rewrite_rules(); } register_activation_hook( FILE, 'lux_rewrite_flush' ); } add_action( 'init', 'lux_course_init' );
Lux Courses Custom Post Type Plugin
Lux Courses Custom Post Type
Nuevo Lux Course
Nuevo Lux Course
Indice Lux Courses
Lux Course
Cursos Afectiva
Cursos Afectiva
Cursos Afectiva
Cursos Afectiva
Plugin Relacionado
Informes AGEPEM
Informes AGEPEM
Plugin Relacionado
Plugin Relacionado
Portfolio Lux
!Gracias por vuestra atención @gpjalameda en Twitter Lux Design Works & Love Your Website
Gracias!
Agradecimientos @WPMajadahonda @CowUpCo @HoyStreaming @hostfusion
Preguntas?
Lux Design Works & Love Your Website