I have a list of articles on my website.
Some of the articles are post types with the "Article" category and others are PDF files uploaded to the media library, also with the "Article" category. I added categories to the media library using these functions in functions.php:
// add categories for attachments
function add_categories_for_attachments() {
register_taxonomy_for_object_type( 'category', 'attachment' );
}
add_action( 'init' , 'add_categories_for_attachments' );
// add tags for attachments
function add_tags_for_attachments() {
register_taxonomy_for_object_type( 'post_tag', 'attachment' );
}
add_action( 'init' , 'add_tags_for_attachments' );
thanks to this article.
I need to display a single category page which lists both types of posts (media and regular posts).
Is there a simple way to achieve it?