• Resolved ratterizzo

    (@ratterizzo)


    Hi

    Again a newbie question: I’d like to show all pix of an attachment_category. Easy so far. But if a picture is also in a second category, it should not appear.

    How to do that? I already did some tries with category_not_in but without success.

    Cheers
    Daniel

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question. I have had success with this shortcode on my test system:

    [mla_gallery]
    tax_query="array(
        'relation' => 'AND',
        array(
            'taxonomy'=>'attachment_category',
            'field'=>'slug',
            'terms'=> array( 'new-category' ),
            'operator' => 'IN',
            ),
        array(
            'taxonomy'=>'attachment_category',
            'field'=>'slug',
            'terms'=> array( 'short' ),
            'operator' => 'NOT IN',
            )
        )"
    [/mla_gallery]
    

    Of course, you will have to replace new-category and short with the appropriate term slugs from your application.

    I have used the alternate “enclosing shortcode” syntax to avoid problems that WordPress has with parameters that include => characters.

    I am marking this topic resolved, but please update it if you have problems or further questions regarding the above suggestion. Thanks for your continuing interest in the plugin.

    Thread Starter ratterizzo

    (@ratterizzo)

    OMG!

    I couldnt develope this on my own from scratch!!! Thanks a lot, it works perfectly!!!

    Cheers
    Daniel

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excluding Categories’ is closed to new replies.