WordPress.org

Support

Support » Plugins and Hacks » [Resolved] use in category.php

[Resolved] use in category.php

  • deepbevel
    Member

    @deepbevel

    I have this in category.php

    $args = array(
    'post_type' => 'attachment',
    'numberposts' => -1,
    'post_status' => null,
    'post_parent' => $post->ID,
     'cat' => 14
    ); 
    
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ( $attachments as $attachment ) {
    		echo apply_filters(

    I’m currently doing with a conditional for media category id=15:

    if(is_category('my-media-category')) {

    but, rather than include cat => 15,
    is there a way to get the attachments from whatever post category is current in category.php?

    my categeory.php template
    what if looks like on the site
    ..pending any fiddling I may do in the mean time.

    thanks!

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

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

    @eddiemoya

    How you get the current category depends on several aspects of where your trying to do it. You can use get_the_category() or get_query_var(‘cat’). Theres other ways, depends on your circumstances. In any case getting the current category is a question about WordPress, not this plugin. I would suggest the forums, stackoverflow, or other areas where you can ask your question to a larger audience.

    http://codex.wordpress.org/Function_Reference/get_the_category

    deepbevel
    Member

    @deepbevel

    thanks, and sorry, it’s hard to draw the line sometimes.. Media Cateories appear in the standard wp categoriy widget, but when the links are clicked, no images appear in category.php.

    I understand it’s because no attachments are being called in the output, but when I try to do that, I get all attachments unless I specify a category.

    So, if the plugin can’t get categories like it does posts (without adding conditionals), I don’t want to spend too much time trying, with the mistaken assumption that I only need to understand the wp part to make it happen. Hope that makes sence.

    Anyway I’ll resolve the thread, if there’s anythng else you could share regarding this it’s most appreciated.

    deepbevel
    Member

    @deepbevel

    media-categories with the attachment images, image titles, parent post titles, and linked author display names. It’s exact;y what I’ve been after. Finally!
    example
    code as used in category.php for twentyten

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] use in category.php’ is closed to new replies.