Beschreibung
Das Plugin fügt zwei Taxonomien zur WordPress-Mediathek hinzu, welche anschließend das Kategorisieren und Verschlagworten deiner Anhänge ermöglicht. Standardmäßig werden diese Taxonomien, obwohl sie im Namen und Verhalten übereinstimmen, separat von den üblichen Beitrags-Taxonomien behandelt, dies kann aber, falls gewünscht, leicht geändert werden.
Das Plugin folgt WordPress Core-Prinzipien und bietet eine einfache Alternative zu ähnlichen Ansätzen an, welche oft extrem flexibel, aber dadurch auch kompliziert und aufgebläht wirken. Und falls du dich ein bisschen mit Programmierung auskennst, sollte es kein Problem sein, das Plugin an deine exakten Anforderungen anzupassen, falls dich die Standardkonfiguration nicht zufrieden stellt.
Features
- Fügt Kategorien und Schlagworte zur Mediathek hinzu (unabhängig von den regulären Beitrags-Kategorien/Schlagworten)
- Fügt Filter-Auswahlmenüs für Anhangs-Taxonomien in die Medien-Werkzeugleiste und das Medien-Popup ein
- Erlaubt das Auswählen von Taxonomie-Begriffen für Anhänge von den Popups zur Anhangsauswahl und Anhangsbearbeitung aus
- Fügt eine Einstellung für die Standard-Anhangs-Kategorie hinzu
- Erweitert den
[gallery]
-Shortcode, sodass Bilder aus einer speziellen Anhangs-Taxonomie automatisch eingebunden werden - Simples Plugin nach WordPress Core-Prinzipien
- „Entscheidungen statt Optionen“
- Kann leicht als Must-Use Plugin verwendet werden
- Bietet eine flexible API für Entwickler, um andere Anhangs-Taxonomien hinzuzufügen oder die existierenden zu entfernen
- Fügt ein einfach verwendbares
has_default
-Argument hinzu, das beim Registrieren einer Anhangs-Taxonomie verwendet werden kann, um automatisch eine Einstellung für den Standard Taxonomie-Term hinzuzufügen - Entwickler können frei entscheiden, ob sie den vom Plugin bereitgestellten objektorientierten Ansatz oder die üblichen WordPress Core Funktionen benutzen möchten
Installation
Als reguläres Plugin
- Lade den gesamten
attachment-taxonomies
-Ordner ins/wp-content/plugins/
-Verzeichnis hoch oder lade das Plugin durch das WordPress-Backend herunter. - Aktiviere das Plugin durch das ‚Plugins‘-Menü in WordPress.
Als Must Use-Plugin
Falls du nicht weißt, was ein Must Use-Plugin ist, magst du vielleicht die Einführung im WordPress Codex lesen – keine Sorge, diese ist nicht nur für Entwickler gedacht.
- Lade den gesamten
attachment-taxonomies
-Ordner ins/wp-content/mu-plugins/
-Verzeichnis hoch (erstelle das Verzeichnis, falls es nicht existiert). - Verschiebe die Datei
/wp-content/mu-plugins/attachment-taxonomies/attachment-taxonomies.php
aus ihrem Verzeichnis nach/wp-content/mu-plugins/attachment-taxonomies.php
.
Beachte, dass Must Use-Plugins, während sie den Vorteil haben, dass sie nicht aus dem Admin-Bereich heraus deaktiviert werden können, nicht durch WordPress aktualisiert werden können. Es wird also empfohlen, dass du sie manuell aktuell hältst.
Administration
Sobald das Plugin aktiviert ist, findest du zwei neue Untermenü-Punkte unter „Medien“ (Kategorien und Schlagwörter). Das Plugin folgt der WordPress Core-Philosophie „Entscheidungen statt Optionen“ – deshalb gibt es keinen zusätzlichen Einstellungs-Bildschirm. Trotzdem ist das Plugin leicht erweiterbar und modifizierbar für Entwickler (siehe FAQ). Falls also die Basiskonfiguration nicht an deine Bedürfnisse angepasst ist, sollte es nicht allzu schwer sein, dies zu ändern.
FAQ
Note that all code samples below should be run before the init
action hook and not earlier than the plugins_loaded
(or muplugins_loaded
if you use the plugin as a must-use plugin) hook.
- Installationsanweisungen
-
Als reguläres Plugin
- Lade den gesamten
attachment-taxonomies
-Ordner ins/wp-content/plugins/
-Verzeichnis hoch oder lade das Plugin durch das WordPress-Backend herunter. - Aktiviere das Plugin durch das ‚Plugins‘-Menü in WordPress.
Als Must Use-Plugin
Falls du nicht weißt, was ein Must Use-Plugin ist, magst du vielleicht die Einführung im WordPress Codex lesen – keine Sorge, diese ist nicht nur für Entwickler gedacht.
- Lade den gesamten
attachment-taxonomies
-Ordner ins/wp-content/mu-plugins/
-Verzeichnis hoch (erstelle das Verzeichnis, falls es nicht existiert). - Verschiebe die Datei
/wp-content/mu-plugins/attachment-taxonomies/attachment-taxonomies.php
aus ihrem Verzeichnis nach/wp-content/mu-plugins/attachment-taxonomies.php
.
Beachte, dass Must Use-Plugins, während sie den Vorteil haben, dass sie nicht aus dem Admin-Bereich heraus deaktiviert werden können, nicht durch WordPress aktualisiert werden können. Es wird also empfohlen, dass du sie manuell aktuell hältst.
Administration
Sobald das Plugin aktiviert ist, findest du zwei neue Untermenü-Punkte unter „Medien“ (Kategorien und Schlagwörter). Das Plugin folgt der WordPress Core-Philosophie „Entscheidungen statt Optionen“ – deshalb gibt es keinen zusätzlichen Einstellungs-Bildschirm. Trotzdem ist das Plugin leicht erweiterbar und modifizierbar für Entwickler (siehe FAQ). Falls also die Basiskonfiguration nicht an deine Bedürfnisse angepasst ist, sollte es nicht allzu schwer sein, dies zu ändern.
- Lade den gesamten
- How can I add more attachment taxonomies?
-
You can simply use the WordPress Core function
register_taxonomy()
and specify'attachment'
as the second parameter. As an alternative, you can create your own class for the taxonomy, extending the abstractAttachment_Taxonomy
class provided by the plugin. Then you can add it using the methodadd_taxonomy( $taxonomy )
of the classAttachment_Taxonomies
.Example Code (adds an attachment taxonomy called „Location“):
<?php final class Attachment_Location extends Attachment_Taxonomy { protected $slug = 'attachment_location'; protected $labels = array( 'name' => __( 'Locations', 'textdomain' ), 'singular_name' => __( 'Location', 'textdomain' ), /* more labels here... */ ); protected $args = array( 'hierarchical' => true, 'query_var' => 'location', /* more arguments here... */ ); } Attachment_Taxonomies::instance()->add_taxonomy( new Attachment_Location() );
- How can I remove the default attachment taxonomies?
-
To remove one of the default attachment taxonomies you should call the method
remove_taxonomy( $taxonomy_slug )
of the classAttachment_Taxonomies
.Example Code (removes the attachment taxonomy „Category“):
<?php Attachment_Taxonomies::instance()->remove_taxonomy( 'attachment_category' );
- How can I use the regular post categories and post tags for attachments instead of the additional taxonomies ?
-
To accomplish that, first you need to remove the two taxonomies that the plugin adds (
attachment_category
andattachment_tag
). See above for instructions on how to do that.Then you can simply use the WordPress Core function
register_taxonomy_for_object_type()
and specify'attachment'
as the second parameter. As an alternative, you can create your own instance of theAttachment_Existing_Taxonomy
class provided by the plugin. Then you can add it using the methodadd_taxonomy( $taxonomy, $existing )
of the classAttachment_Taxonomies
, with the second parameter set totrue
.Example Code (makes the regular category and tag taxonomies available for attachments):
<?php Attachment_Taxonomies::instance()->add_taxonomy( new Attachment_Existing_Taxonomy( 'category' ), true ); Attachment_Taxonomies::instance()->add_taxonomy( new Attachment_Existing_Taxonomy( 'post_tag' ), true );
- How do I use the enhanced version of the `[gallery]` shortcode?
-
The
[gallery]
shortcode can now be passed taxonomy attributes. They have to have the attachment taxonomy slug as the attribute name and a comma-separated list of term slugs or term IDs as value. You may also specify a new „limit“ attribute to limit the amount of images shown. This is especially recommended if the attachment taxonomy term you are querying for contains a lot of images.Example Code (shows images with attachment categories 1 or 2 or attachment tag 5 with a limit of 20 images shown):
[gallery attachment_category="1,2" attachment_tag="5" limit="20"]
Note that there is currently no UI in the backend for this, and the preview in the editor will not work properly. It will show up correctly in the frontend though.
- Which filters are available in the plugin?
-
The plugin provides some filters to adjust taxonomy arguments and labels.
attachment_taxonomy_args
where first argument is the array of taxonomy arguments and the second argument is the taxonomy slug that these arguments apply toattachment_taxonomy_{$taxonomy_slug}_args
where the only argument is the array of taxonomy arguments for the taxonomy defined by$taxonomy_slug
attachment_taxonomy_labels
where first argument is the array of taxonomy labels and the second argument is the taxonomy slug that these labels apply toattachment_taxonomy_{$taxonomy_slug}_labels
where the only argument is the array of taxonomy labels for the taxonomy defined by$taxonomy_slug
- Where should I submit my support request?
-
I preferably take support requests as issues on Github, so I would appreciate if you created an issue for your request there. However, if you don’t have an account there and do not want to sign up, you can of course use the wordpress.org support forums as well.
- How can I contribute to the plugin?
-
If you’re a developer and you have some ideas to improve the plugin or to solve a bug, feel free to raise an issue or submit a pull request in the Github repository for the plugin.
You can also contribute to the plugin by translating it. Simply visit translate.wordpress.org to get started.
Rezensionen
Mitwirkende & Entwickler
„Attachment Taxonomies“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:
Mitwirkende„Attachment Taxonomies“ wurde in 2 Sprachen übersetzt. Danke an die Übersetzerinnen und Übersetzer für ihre Mitwirkung.
Übersetze „Attachment Taxonomies“ in deine Sprache.
Interessiert an der Entwicklung?
Durchstöbere den Code, sieh dir das SVN Repository an oder abonniere das Entwicklungsprotokoll per RSS.
Änderungsprotokoll
1.1.1
- Enhanced: The plugin’s attachment taxonomies now use dedicated capabilities that map to core capabilities
- Tweaked: Remove access docblock annotations per WordPress coding standards
- Fixed: Taxonomy fields in media modal are now readonly if the user does not have sufficient capabilities
- Fixed: Gallery shortcode without taxonomy attributes now works correctly again
- Fixed: No longer are duplicate attachment IDs requested in the gallery shortcode
1.1.0
- Added: There is now a settings field for the default attachment category. For other attachment taxonomies they can easily be added by passing a
has_default
argument oftrue
when registering the taxonomy. - Added: The
[gallery]
shortcode now supports passing taxonomy arguments: The slug of a taxonomy can be given alongside with a comma-separated list of term slugs or IDs. - Added: New filter
attachment_taxonomy_class_names
can be used to filter the class names for the taxonomies that should be registered by default. - Tweaked: Properly escape attributes in admin UI and style rules. Props tareiking.
- Tweaked: Store custom and existing taxonomies in the same internal container and deprecate the now unnecessary
$existing
parameter across several functions. - Tweaked: Follow WordPress Documentation Standards.
- Tweaked: Modernize Travis-CI configuration and code climate checks.
- Fixed: Initialization no longer fails when using as an mu-plugin without moving the main file one level above. Props tareiking.
- Fixed: Correct property is used when referring to the taxonomy query var and the taxonomy slug respectively. Props tareiking.
1.0.1
- Fixed: uploads in the post edit screen no longer freeze
1.0.0
- First stable version