How can I call the name of an attachment category?
Something that would look like <?php get_attachment_category_name ?>
or $attachment->category_name
This would simply output the name of the category, which was created using the below function:
function add_categories_to_attachments() {
register_taxonomy_for_object_type( 'category', 'attachment' );
}
add_action( 'init' , 'add_categories_to_attachments' );
attachment.php
template file?<?php $attachment_data = wp_prepare_attachment_for_js( $attachment->ID ); echo '.get_cat_name($catid).'; ?>