• Saltar a la navegación principal
  • Saltar al contenido principal
  • Saltar al pie de página
labarta

Labarta

  • Blog
  • Vídeos Docker
  • Vídeos entrevistas
  • Dominios
  • Hosting
  • Quién soy

Crear nuevas categorías y etiquetas en la Biblioteca de Medios

17/09/2019

medios-carpetas

 

Crear nuevas categorías y etiquetas en la Biblioteca de Medios

 

Para crear nuevas categorías y etiquetas en la Biblioteca de Medios, simplemente debemos añadir este código en un snippet o en functions.php de tu tema o mejor de tu tema hijo.

 

snippet-1

 

 

Código "Carpetas":

/* Crear Carpetas en Medios */
function jml_folder_taxonomies() {
$labels = array(
'name' => _x( 'Carpeta', 'taxonomy general name' ),
'singular_name' => _x( 'Carpetas', 'taxonomy singular name' ),
'search_items' => __( 'Buscar carpetas' ),
'all_items' => __( 'Todas las carpetas' ),
'parent_item' => __( 'Carpeta superior' ),
'parent_item_colon' => __( 'Carpeta superior:' ),
'edit_item' => __( 'Editar' ),
'update_item' => __( 'Actualizar' ),
'not_found' => __( 'No se encontraron carpetas' ),
'no_terms' => __( 'No hay carpetas' ),
'add_new_item' => __( 'Añadir nueva' ),
'new_item_name' => __( 'Nuevo nombre' ),
'menu_name' => __( 'Carpetas' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'folder' ),
);
register_taxonomy( 'folder', array( 'attachment' ), $args );
}
add_action( 'init', 'jml_folder_taxonomies', 0 );

 

He puesto como nombre "Carpetas"  pero en realidad (no son carpetas como tal) son categorías, las he nombrado así para que se vea que realmente son diferentes de las categorías de las entradas.

Si lo deseas puedes cambiar su nombre a "Categorías" o a lo que tu precises. 

 

agregar-carpeta

 

Código "Etiquetas":

function jml_tags_taxonomies() {
$labels = array(
'name' => _x( 'Etiqueta', 'taxonomy general name' ),
'singular_name' => _x( 'Etiquetas', 'taxonomy singular name' ),
'search_items' => __( 'Buscar etiquetas' ),
'all_items' => __( 'Todas las etiquetas' ),
'edit_item' => __( 'Editar' ),
'update_item' => __( 'Actualizar' ),
'add_new_item' => __( 'Añadir nueva' ),
'new_item_name' => __( 'Nuevo nombre' ),
'menu_name' => __( 'Etiquetas' ),
);
$args = array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'my-tags' ),
);
register_taxonomy( 'my-tags', array( 'attachment' ), $args );
}
add_action( 'init', 'jml_tags_taxonomies', 0 );

 

En el listado de medios podemos conseguir que  Carpetas  y  Etiquetas  sean ordenables.

 

listado

 

El código necesarios para esto: 

 

/* Sortable Folders in columns */
function jml_sortable_folders_column( $columns ) {
$columns['taxonomy-folder'] = 'Folder';
return $columns;
}
add_filter( 'manage_upload_sortable_columns', 'jml_sortable_folders_column' );
/* Sortable Tags in columns */
function jml_sortable_tags_column( $columns ) {
$columns['taxonomy-my-tags'] = 'Etiquetas';
return $columns;
}
add_filter( 'manage_upload_sortable_columns', 'jml_sortable_tags_column' );

 

Espero que esto te ayude a ordenar mejor los documentos e imágenes  en Medios.

 

En un próximo artículo veremos como crear realmente  "Carpetas" en  la  Biblioteca de Medios.

 


Si te ha gustado este artículo, por favor, comparte - Gracias -


Artículos Relacionados

  • lab-featured-image-2 Mostrar imágenes destacadas en el listado de entradas de WordPress
  • folder-labarta Crear carpetas en la Biblioteca de Medios
  • menu-medios Agregar categorías y etiquetas en la Biblioteca de Medios
  • papelera Cómo activar la papelera en la biblioteca de medios de WordPress

Blog,  Código medios

  • Todas las entradas
  • Github
  • Meetup WordPress
  • Política de cookies

Footer

GINERNET - Servidor VPS

Ginernet

GeneratePress - Tema WordPress

GeneratePress

GINERNET - Hosting WordPress

Ginernet2

OnlyOffice - Online Office

Usamos ONLYOFFICE Online Office

Copyright © 2025 · Labarta - Powered by : Labarta

Usamos cookies en nuestro sitio web para brindarle la experiencia más relevante recordando sus preferencias y visitas repetidas. Al hacer clic en “Aceptar todo”, acepta el uso de todas las cookies. Sin embargo, puede visitar "Configuración cookies" para proporcionar un consentimiento controlado.
Configuración cookiesAceptar todo
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Siempre activado
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDuraciónDescripción
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
GUARDAR Y ACEPTAR