Support » Plugin: Media Categories » Category Archive URL

  • Resolved bradgb

    (@bradgb)


    I have the following category hierarchy

    /technical-support/application-notes/

    I have assigned a media item the application-notes category. It all looks correct in the admin interface, but it does not show up when I browse the public category archive page. What is the correct url/way to view media items in a category archive listing?

    http://wordpress.org/extend/plugins/media-categories-2/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Eddie Moya

    (@eddiemoya)

    It depends on the query that is being made by that category archive. All this plugin does is let you taxonomize your media, it doesn’t change the way your theme or plugins query for posts.

    The plugin has one end-user friendly feature in that it allows you to use [gallery] shortcode and filter by category. Other than this, its mostly a tool for developers.

    If you are trying to get images to show up in a normal category archive page, you probably need to use pre_get_posts filter to change that query. Check for is_cagetory() to make sure it only happens for category archives, after which you can just add attachments to the post_type parameter to the query.

    http://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters
    http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

    Thread Starter bradgb

    (@bradgb)

    Eddie,

    So WordPress must use post_type=”post” in its category query, makes sense. Thanks!

    Plugin Author Eddie Moya

    (@eddiemoya)

    Well if you want to include attachments, you will want to use $query->set(‘post_type, array(‘post’, attachment’));

    This should make it so that both attachments and posts show up for that category. You are probably going to want to create some sort of special template for those images too.

    Just a thought, if your primary interest is presenting images side by side with posts, you might just want to make use of post-formats.

    The downside with post-formats is that you then have to actually create posts for each image, which may simply not be what you want to do. Just a thought.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Category Archive URL’ is closed to new replies.