Created
February 9, 2024 18:37
-
-
Save cesjam7/9747e949930295f82b1beee371ced8c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_init', 'wpmico_custom_admin_init' ); | |
function wpmico_custom_admin_init() { | |
if (!empty($_GET['dev'])) { | |
//phpinfo();die; | |
} | |
} | |
add_action('acf/init', 'my_acf_init'); | |
function my_acf_init() { | |
acf_update_setting('capability', 'edit_posts'); | |
acf_update_setting('google_api_key', 'AIzaSyB_p4nEvz2q1AMaB7ZBeJer1RFZMEkvKjw'); | |
} | |
add_action( 'init', 'wpmico_custom_init' ); | |
function wpmico_custom_init() { | |
if (!empty($_GET['dev'])) { | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(E_ALL); | |
} | |
if( function_exists('acf_add_options_page') ) { | |
// add parent | |
$parent = acf_add_options_page(array( | |
'page_title' => __( 'Configuración', 'ositran' ), | |
'menu_title' => __( 'Configuración', 'ositran' ), | |
'menu_slug' => 'configuracion', | |
'redirect' => false, | |
)); | |
$child = acf_add_options_sub_page(array( | |
'page_title' => __( 'CEU Inscripción', 'ositran' ), | |
'menu_title' => __( 'CEU Inscripción', 'ositran' ), | |
'parent_slug' => $parent['menu_slug'], | |
'capability' => 'ceu_inscripcion' | |
)); | |
acf_add_options_sub_page(array( | |
'page_title' => 'Configuración - Carreteras', | |
'menu_title' => 'Opciones Carreteras', | |
'parent_slug' => 'edit.php?post_type=carreteras', | |
)); | |
acf_add_options_sub_page(array( | |
'page_title' => 'Configuración - Aeropuertos', | |
'menu_title' => 'Opciones Aeropuertos', | |
'parent_slug' => 'edit.php?post_type=aeropuertos', | |
)); | |
acf_add_options_sub_page(array( | |
'page_title' => 'Configuración - Puertos', | |
'menu_title' => 'Opciones Puertos', | |
'parent_slug' => 'edit.php?post_type=puertos', | |
)); | |
acf_add_options_sub_page(array( | |
'page_title' => 'Configuración - Ferrovías', | |
'menu_title' => 'Opciones Ferrovías', | |
'parent_slug' => 'edit.php?post_type=vias-ferreas', | |
)); | |
acf_add_options_sub_page(array( | |
'page_title' => 'Configuración - Metro de Lima', | |
'menu_title' => 'Opciones Metro de Lima', | |
'parent_slug' => 'edit.php?post_type=metro-de-lima', | |
)); | |
acf_add_options_sub_page(array( | |
'page_title' => 'Configuración - Hidrovías', | |
'menu_title' => 'Opciones Hidrovías', | |
'parent_slug' => 'edit.php?post_type=hidrovias', | |
)); | |
} | |
register_post_type('noticias', array( | |
'label' => __( 'Notas de prensa', 'ositran' ), | |
'description' => __( 'Custom Post Type para Noticias', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Notas de prensa', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Notas de prensa', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Notas de prensa', 'ositran' ), | |
'parent_item_colon' => __( 'De Nota:', 'ositran' ), | |
'all_items' => __( 'Todas las Notas', 'ositran' ), | |
'view_item' => __( 'Ver Nota', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Nota', 'ositran' ), | |
'add_new' => __( 'Nueva Nota', 'ositran' ), | |
'edit_item' => __( 'Editar Nota', 'ositran' ), | |
'update_item' => __( 'Actualizar Nota', 'ositran' ), | |
'search_items' => __( 'Buscar Nota', 'ositran' ), | |
'not_found' => __( 'No se encontraron notas', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron notas eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'noticias' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail', 'excerpt'), | |
'menu_icon' => 'dashicons-format-aside' | |
)); | |
register_post_type('novedades', array( | |
'label' => __( 'Novedades', 'ositran' ), | |
'description' => __( 'Custom Post Type para Novedades', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Novedades', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Novedad', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Novedades', 'ositran' ), | |
'parent_item_colon' => __( 'De Novedad:', 'ositran' ), | |
'all_items' => __( 'Todas las Novedades', 'ositran' ), | |
'view_item' => __( 'Ver Novedad', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Novedad', 'ositran' ), | |
'add_new' => __( 'Nueva Novedad', 'ositran' ), | |
'edit_item' => __( 'Editar Novedad', 'ositran' ), | |
'update_item' => __( 'Actualizar Novedad', 'ositran' ), | |
'search_items' => __( 'Buscar Novedad', 'ositran' ), | |
'not_found' => __( 'No se encontraron novedades', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron novedades eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'novedades' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail', 'excerpt'), | |
'menu_icon' => 'dashicons-format-aside' | |
)); | |
register_post_type('publicaciones', array( | |
'label' => __( 'Publicaciones', 'ositran' ), | |
'description' => __( 'Custom Post Type para Publicaciones', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Publicaciones', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Publicación', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Publicaciones', 'ositran' ), | |
'parent_item_colon' => __( 'De Publicación:', 'ositran' ), | |
'all_items' => __( 'Todas las Publicaciones', 'ositran' ), | |
'view_item' => __( 'Ver Publicación', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Publicación', 'ositran' ), | |
'add_new' => __( 'Nueva Publicación', 'ositran' ), | |
'edit_item' => __( 'Editar Publicación', 'ositran' ), | |
'update_item' => __( 'Actualizar Publicación', 'ositran' ), | |
'search_items' => __( 'Buscar Publicación', 'ositran' ), | |
'not_found' => __( 'No se encontraron publicaciones', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron publicaciones eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail', 'excerpt'), | |
'menu_icon' => 'dashicons-admin-post' | |
)); | |
register_taxonomy( 'tipo-publicaciones', 'publicaciones', array( | |
'hierarchical' => true, | |
'labels' => array( | |
'name' => _x( 'Tipos de publicaciones', 'Nombre general de taxonomía', 'ositran' ), | |
'singular_name' => _x( 'Tipo', 'Nombre singular de taxonomía', 'ositran' ), | |
'search_items' => __( 'Buscar Tipos', 'ositran' ), | |
'all_items' => __( 'Todos los Tipos', 'ositran' ), | |
'parent_item' => __( 'Tipo Superior', 'ositran' ), | |
'parent_item_colon' => __( 'Tipo Superior:', 'ositran' ), | |
'edit_item' => __( 'Editar Tipo', 'ositran' ), | |
'update_item' => __( 'Actualizar Tipo', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Tipo', 'ositran' ), | |
'new_item_name' => __( 'Nuevo nombre de Tipo', 'ositran' ), | |
'menu_name' => __( 'Tipos', 'ositran' ), | |
), | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'publicaciones' ), | |
)); | |
register_post_type('resoluciones', array( | |
'label' => __( 'Resoluciones', 'ositran' ), | |
'description' => __( 'Custom Post Type para Resoluciones', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Resoluciones', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Publicación', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Resoluciones', 'ositran' ), | |
'parent_item_colon' => __( 'De Resolución:', 'ositran' ), | |
'all_items' => __( 'Todas las Resoluciones', 'ositran' ), | |
'view_item' => __( 'Ver Resolución', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Resolución', 'ositran' ), | |
'add_new' => __( 'Nueva Resolución', 'ositran' ), | |
'edit_item' => __( 'Editar Resolución', 'ositran' ), | |
'update_item' => __( 'Actualizar Resolución', 'ositran' ), | |
'search_items' => __( 'Buscar Resolución', 'ositran' ), | |
'not_found' => __( 'No se encontraron resoluciones', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron resoluciones eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-admin-post' | |
)); | |
register_taxonomy( 'tipo-resoluciones', 'resoluciones', array( | |
'hierarchical' => true, | |
'labels' => array( | |
'name' => _x( 'Tipos', 'Nombre general de taxonomía', 'ositran' ), | |
'singular_name' => _x( 'Tipo', 'Nombre singular de taxonomía', 'ositran' ), | |
'search_items' => __( 'Buscar Tipos', 'ositran' ), | |
'all_items' => __( 'Todos los Tipos', 'ositran' ), | |
'parent_item' => __( 'Tipo Superior', 'ositran' ), | |
'parent_item_colon' => __( 'Tipo Superior:', 'ositran' ), | |
'edit_item' => __( 'Editar Tipo', 'ositran' ), | |
'update_item' => __( 'Actualizar Tipo', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Tipo', 'ositran' ), | |
'new_item_name' => __( 'Nuevo nombre de Tipo', 'ositran' ), | |
'menu_name' => __( 'Tipos', 'ositran' ), | |
), | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'resoluciones' ), | |
)); | |
register_post_type('actas', array( | |
'label' => __( 'Actas', 'ositran' ), | |
'description' => __( 'Custom Post Type para Actas', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Actas', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Acta', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Actas', 'ositran' ), | |
'parent_item_colon' => __( 'De Acta:', 'ositran' ), | |
'all_items' => __( 'Todas las Actas', 'ositran' ), | |
'view_item' => __( 'Ver Acta', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Acta', 'ositran' ), | |
'add_new' => __( 'Nueva Acta', 'ositran' ), | |
'edit_item' => __( 'Editar Acta', 'ositran' ), | |
'update_item' => __( 'Actualizar Acta', 'ositran' ), | |
'search_items' => __( 'Buscar Acta', 'ositran' ), | |
'not_found' => __( 'No se encontraron actas', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron actas eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-admin-post' | |
)); | |
register_taxonomy( 'tipo-actas', 'actas', array( | |
'hierarchical' => true, | |
'labels' => array( | |
'name' => _x( 'Tipos', 'Nombre general de taxonomía', 'ositran' ), | |
'singular_name' => _x( 'Tipo', 'Nombre singular de taxonomía', 'ositran' ), | |
'search_items' => __( 'Buscar Tipos', 'ositran' ), | |
'all_items' => __( 'Todos los Tipos', 'ositran' ), | |
'parent_item' => __( 'Tipo Superior', 'ositran' ), | |
'parent_item_colon' => __( 'Tipo Superior:', 'ositran' ), | |
'edit_item' => __( 'Editar Tipo', 'ositran' ), | |
'update_item' => __( 'Actualizar Tipo', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Tipo', 'ositran' ), | |
'new_item_name' => __( 'Nuevo nombre de Tipo', 'ositran' ), | |
'menu_name' => __( 'Tipos', 'ositran' ), | |
), | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'actas' ), | |
)); | |
register_post_type('convocatorias', array( | |
'label' => __( 'Convocatorias', 'ositran' ), | |
'description' => __( 'Custom Post Type para Convocatorias', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Convocatorias', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Convocatoria', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Convocatorias', 'ositran' ), | |
'parent_item_colon' => __( 'De Convocatoria:', 'ositran' ), | |
'all_items' => __( 'Todas las Convocatorias', 'ositran' ), | |
'view_item' => __( 'Ver Convocatoria', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Convocatoria', 'ositran' ), | |
'add_new' => __( 'Nueva Convocatoria', 'ositran' ), | |
'edit_item' => __( 'Editar Convocatoria', 'ositran' ), | |
'update_item' => __( 'Actualizar Convocatoria', 'ositran' ), | |
'search_items' => __( 'Buscar Convocatoria', 'ositran' ), | |
'not_found' => __( 'No se encontraron convocatorias', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron convocatorias eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-admin-post' | |
)); | |
register_taxonomy( 'tipo-convocatorias', 'convocatorias', array( | |
'hierarchical' => true, | |
'labels' => array( | |
'name' => _x( 'Tipos', 'Nombre general de taxonomía', 'ositran' ), | |
'singular_name' => _x( 'Tipo', 'Nombre singular de taxonomía', 'ositran' ), | |
'search_items' => __( 'Buscar Tipos', 'ositran' ), | |
'all_items' => __( 'Todos los Tipos', 'ositran' ), | |
'parent_item' => __( 'Tipo Superior', 'ositran' ), | |
'parent_item_colon' => __( 'Tipo Superior:', 'ositran' ), | |
'edit_item' => __( 'Editar Tipo', 'ositran' ), | |
'update_item' => __( 'Actualizar Tipo', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Tipo', 'ositran' ), | |
'new_item_name' => __( 'Nuevo nombre de Tipo', 'ositran' ), | |
'menu_name' => __( 'Tipos', 'ositran' ), | |
), | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'convocatorias' ), | |
)); | |
register_taxonomy( 'tipo-convocatorias', 'convocatorias', array( | |
'hierarchical' => true, | |
'labels' => array( | |
'name' => _x( 'Tipos', 'Nombre general de taxonomía', 'ositran' ), | |
'singular_name' => _x( 'Tipo', 'Nombre singular de taxonomía', 'ositran' ), | |
'search_items' => __( 'Buscar Tipos', 'ositran' ), | |
'all_items' => __( 'Todos los Tipos', 'ositran' ), | |
'parent_item' => __( 'Tipo Superior', 'ositran' ), | |
'parent_item_colon' => __( 'Tipo Superior:', 'ositran' ), | |
'edit_item' => __( 'Editar Tipo', 'ositran' ), | |
'update_item' => __( 'Actualizar Tipo', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Tipo', 'ositran' ), | |
'new_item_name' => __( 'Nuevo nombre de Tipo', 'ositran' ), | |
'menu_name' => __( 'Tipos', 'ositran' ), | |
), | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'tipo' ), | |
)); | |
register_taxonomy( 'ano-convocatorias', 'convocatorias', array( | |
'hierarchical' => true, | |
'labels' => array( | |
'name' => _x( 'Años', 'Nombre general de taxonomía', 'ositran' ), | |
'singular_name' => _x( 'Año', 'Nombre singular de taxonomía', 'ositran' ), | |
'search_items' => __( 'Buscar Años', 'ositran' ), | |
'all_items' => __( 'Todos los Años', 'ositran' ), | |
'parent_item' => __( 'Año Superior', 'ositran' ), | |
'parent_item_colon' => __( 'Año Superior:', 'ositran' ), | |
'edit_item' => __( 'Editar Año', 'ositran' ), | |
'update_item' => __( 'Actualizar Año', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Año', 'ositran' ), | |
'new_item_name' => __( 'Nuevo nombre de Año', 'ositran' ), | |
'menu_name' => __( 'Años', 'ositran' ), | |
), | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'ano' ), | |
)); | |
register_post_type('peajes', array( | |
'label' => __( 'Peajes', 'ositran' ), | |
'description' => __( 'Custom Post Type para Peajes', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Peajes', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Peaje', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Peajes', 'ositran' ), | |
'parent_item_colon' => __( 'De Peaje:', 'ositran' ), | |
'all_items' => __( 'Todas las Peajes', 'ositran' ), | |
'view_item' => __( 'Ver Peaje', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Peaje', 'ositran' ), | |
'add_new' => __( 'Nueva Peaje', 'ositran' ), | |
'edit_item' => __( 'Editar Peaje', 'ositran' ), | |
'update_item' => __( 'Actualizar Peaje', 'ositran' ), | |
'search_items' => __( 'Buscar Peajes', 'ositran' ), | |
'not_found' => __( 'No se encontraron Peajes', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron Peajes eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'peajes' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-location-alt' | |
)); | |
register_post_type('carreteras', array( | |
'label' => __( 'Carreteras', 'ositran' ), | |
'description' => __( 'Custom Post Type para Carreteras', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Carreteras', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Carretera', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Carreteras', 'ositran' ), | |
'parent_item_colon' => __( 'De Carretera:', 'ositran' ), | |
'all_items' => __( 'Todas las Carreteras', 'ositran' ), | |
'view_item' => __( 'Ver Carretera', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Carretera', 'ositran' ), | |
'add_new' => __( 'Nueva Carretera', 'ositran' ), | |
'edit_item' => __( 'Editar Carretera', 'ositran' ), | |
'update_item' => __( 'Actualizar Carretera', 'ositran' ), | |
'search_items' => __( 'Buscar Carreteras', 'ositran' ), | |
'not_found' => __( 'No se encontraron Carreteras', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron Carreteras eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'carreteras' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-location-alt' | |
)); | |
register_post_type('aeropuertos', array( | |
'label' => __( 'Aeropuertos', 'ositran' ), | |
'description' => __( 'Custom Post Type para Aeropuertos', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Aeropuertos', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Aeropuerto', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Aeropuertos', 'ositran' ), | |
'parent_item_colon' => __( 'De Aeropuerto:', 'ositran' ), | |
'all_items' => __( 'Todos los Aeropuertos', 'ositran' ), | |
'view_item' => __( 'Ver Aeropuerto', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Aeropuerto', 'ositran' ), | |
'add_new' => __( 'Nuevo Aeropuerto', 'ositran' ), | |
'edit_item' => __( 'Editar Aeropuerto', 'ositran' ), | |
'update_item' => __( 'Actualizar Aeropuerto', 'ositran' ), | |
'search_items' => __( 'Buscar Aeropuertos', 'ositran' ), | |
'not_found' => __( 'No se encontraron Aeropuertos', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron Aeropuertos eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'aeropuertos' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-location-alt' | |
)); | |
register_post_type('puertos', array( | |
'label' => __( 'Puertos', 'ositran' ), | |
'description' => __( 'Custom Post Type para Puertos', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Puertos', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Puerto', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Puertos', 'ositran' ), | |
'parent_item_colon' => __( 'De Puerto:', 'ositran' ), | |
'all_items' => __( 'Todas los Puertos', 'ositran' ), | |
'view_item' => __( 'Ver Puerto', 'ositran' ), | |
'add_new_item' => __( 'Agregar nuevo Puerto', 'ositran' ), | |
'add_new' => __( 'Nuevo Puertos', 'ositran' ), | |
'edit_item' => __( 'Editar Puerto', 'ositran' ), | |
'update_item' => __( 'Actualizar Puerto', 'ositran' ), | |
'search_items' => __( 'Buscar Puertos', 'ositran' ), | |
'not_found' => __( 'No se encontraron Puertos', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron Puertos eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'puertos' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-location-alt' | |
)); | |
register_post_type('vias-ferreas', array( | |
'label' => __( 'Vías Ferreas', 'ositran' ), | |
'description' => __( 'Custom Post Type para Vías Ferreas', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Vías Ferreas', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Vías Ferreas', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Vías Ferreas', 'ositran' ), | |
'parent_item_colon' => __( 'De Vía Ferrea:', 'ositran' ), | |
'all_items' => __( 'Todas las Vías', 'ositran' ), | |
'view_item' => __( 'Ver Vía', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Vía', 'ositran' ), | |
'add_new' => __( 'Nueva Vía Ferrea', 'ositran' ), | |
'edit_item' => __( 'Editar Vía Ferrea', 'ositran' ), | |
'update_item' => __( 'Actualizar Vía Ferrea', 'ositran' ), | |
'search_items' => __( 'Buscar Vías Ferreas', 'ositran' ), | |
'not_found' => __( 'No se encontraron Vías Ferreas', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron Vías Ferreas eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'vias-ferreas' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-location-alt' | |
)); | |
register_post_type('metro-de-lima', array( | |
'label' => __( 'Metro de Lima', 'ositran' ), | |
'description' => __( 'Custom Post Type para Metro de Lima', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Metro de Lima', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Metro de Lima', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Metro de Lima', 'ositran' ), | |
'parent_item_colon' => __( 'De Metro de Lima:', 'ositran' ), | |
'all_items' => __( 'Todas las Vías', 'ositran' ), | |
'view_item' => __( 'Ver Vía', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Vía', 'ositran' ), | |
'add_new' => __( 'Nueva Metro de Lima', 'ositran' ), | |
'edit_item' => __( 'Editar Metro de Lima', 'ositran' ), | |
'update_item' => __( 'Actualizar Metro de Lima', 'ositran' ), | |
'search_items' => __( 'Buscar Metro de Lima', 'ositran' ), | |
'not_found' => __( 'No se encontraron Metro de Lima', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron Metro de Lima eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'metro-de-lima' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-location-alt' | |
)); | |
register_post_type('hidrovias', array( | |
'label' => __( 'Hidrovías', 'ositran' ), | |
'description' => __( 'Custom Post Type para Hidrovías', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Hidrovías', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Hidrovías', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Hidrovías', 'ositran' ), | |
'parent_item_colon' => __( 'De Hidrovía:', 'ositran' ), | |
'all_items' => __( 'Todas las Hidrovías', 'ositran' ), | |
'view_item' => __( 'Ver Hidrovía', 'ositran' ), | |
'add_new_item' => __( 'Agregar nueva Hidrovía', 'ositran' ), | |
'add_new' => __( 'Nueva Hidrovía', 'ositran' ), | |
'edit_item' => __( 'Editar Hidrovía', 'ositran' ), | |
'update_item' => __( 'Actualizar Hidrovía', 'ositran' ), | |
'search_items' => __( 'Buscar Hidrovías', 'ositran' ), | |
'not_found' => __( 'No se encontraron Hidrovías', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron Hidrovías eliminadas', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'hidrovias' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail'), | |
'menu_icon' => 'dashicons-location-alt' | |
)); | |
register_post_type( | |
'ceu-inscripcion', array( | |
'labels' => array('name' => 'CEU Inscripción', 'singular_name' => 'Inscripción'), | |
'public' => true, | |
'exclude_from_search' => true, | |
'show_in_admin_bar' => false, | |
'show_in_nav_menus' => false, | |
'publicly_queryable' => false, | |
'query_var' => false, | |
'menu_icon' => 'dashicons-groups', | |
'supports' => array( 'title', 'author', 'revisions') | |
) | |
); | |
register_post_type('comunicados', array( | |
'label' => __( 'Comunicados', 'ositran' ), | |
'description' => __( 'Custom Post Type para Comunicados', 'ositran' ), | |
'labels' => array( | |
'name' => _x( 'Comunicados', 'Nombre general de post type', 'ositran' ), | |
'singular_name' => _x( 'Comunicados', 'Nombre singular de post type', 'ositran' ), | |
'menu_name' => __( 'Comunicados', 'ositran' ), | |
'parent_item_colon' => __( 'De Comunicados:', 'ositran' ), | |
'all_items' => __( 'Todas los Comunicados', 'ositran' ), | |
'view_item' => __( 'Ver Comunicado', 'ositran' ), | |
'add_new_item' => __( 'Agregar Comunicado', 'ositran' ), | |
'add_new' => __( 'Nuevo Comunicado', 'ositran' ), | |
'edit_item' => __( 'Editar Comunicado', 'ositran' ), | |
'update_item' => __( 'Actualizar Comunicado', 'ositran' ), | |
'search_items' => __( 'Buscar Comunicado', 'ositran' ), | |
'not_found' => __( 'No se encontraron comunicados', 'ositran' ), | |
'not_found_in_trash' => __( 'No se encontraron comunicados eliminados', 'ositran' ), | |
), | |
'public' => TRUE, | |
'rewrite' => array( 'slug' => 'comunicados' ), | |
'has_archive' => TRUE, | |
'supports' => array( 'title', 'editor', 'author', 'revisions', 'thumbnail', 'excerpt'), | |
'menu_icon' => 'dashicons-format-aside' | |
)); | |
// Agregar imagen destacada y tamaño de imagen | |
add_theme_support( 'post-thumbnails' ); | |
// Tamaños de imagenes | |
add_image_size('slider', 1600, 1000, true); | |
add_image_size('noticias', 480, 345, true); | |
// Registrar menus | |
register_nav_menus(array( | |
'principal' => __( 'Principal', 'ositran' ), | |
'footer' => __( 'Pie de Página', 'ositran' ) | |
)); | |
} | |
//add_filter('show_admin_bar', '__return_false'); | |
// Taxonomy y Post Type comparten slug | |
function taxonomy_slug_rewrite($wp_rewrite) { | |
$rules = array(); | |
$taxonomies = get_taxonomies(array('_builtin' => false), 'objects'); | |
$post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); | |
foreach ($post_types as $post_type) { | |
foreach ($taxonomies as $taxonomy) { | |
foreach ($taxonomy->object_type as $object_type) { | |
if ($post_type->rewrite && $object_type == $post_type->rewrite['slug']) { | |
$terms = get_categories(array('type' => $object_type, 'taxonomy' => $taxonomy->name, 'hide_empty' => 0)); | |
foreach ($terms as $term) { | |
$rules[$object_type . '/' . $term->slug . '/?$'] = 'index.php?' . $term->taxonomy . '=' . $term->slug; | |
} | |
} | |
} | |
} | |
} | |
$wp_rewrite->rules = $rules + $wp_rewrite->rules; | |
} | |
add_filter('generate_rewrite_rules', 'taxonomy_slug_rewrite'); | |
//add_filter('show_admin_bar', '__return_false'); | |
// Limit character excerpt | |
function excerpt($limit) { | |
$excerpt = explode(' ', get_the_excerpt(), $limit); | |
if (count($excerpt)>=$limit) { | |
array_pop($excerpt); | |
$excerpt = implode(" ",$excerpt).'...'; | |
} else { | |
$excerpt = implode(" ",$excerpt); | |
} | |
$excerpt = preg_replace('`[[^]]*]`','',$excerpt); | |
return $excerpt; | |
} | |
function bweb_wpsrd_add_post_types( $postTypes ){ | |
$postTypes[] = 'aeropuertos'; | |
return $postTypes; | |
} | |
add_filter( 'wpsrd_post_types_list', 'bweb_wpsrd_add_post_types' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment