Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

xvegax on "NO plugin: Connecting the WordPress gallery feature with custom categories"

$
0
0

Hi guys,

Without using any plugins I want to achieve to get the WordPress own gallery to correspond with custom created categories. I mean, I want to use a gallery without declaring which images to use, but instead just show all images of one category for example.

I created those categories with the following code in my child functions.php:

function is_add_categories_to_attachments() {
register_taxonomy_for_object_type( 'category', 'attachment' );
}
add_action( 'init' , 'is_add_categories_to_attachments' );

So far, everything is good. In the media menu I can add as many categories I want to now. In my case I made three of them, named alpha, beta and gamma.

--- Problem comes now:

But then I tried to combine that within a page with the wordpress gallery code and that just does not work at all:

[gallery type="squares" categories="alpha" order="DESC" orderby="ID" link="file"]

I also tried "category" instead of "categories", but that did not work, too.

So, I guess, there will not be an easy solution or maybe it is easy for programming geniuses (I am not). :) Can you help me out and show me how to combine those?

Thank you very much in advance.


Viewing all articles
Browse latest Browse all 8245

Trending Articles