Plugin Directory

Changeset 153846


Ignore:
Timestamp:
09/11/2009 03:57:22 PM (17 years ago)
Author:
Gargron
Message:
 
Location:
wt-co-authors
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • wt-co-authors/trunk/wt-coauthors.php

    r147595 r153846  
    44Plugin URI: http://anime2.kokidokom.net/all-team-blogs-attention-the-ultimate-mega-super-awesome-co-authors-plugin-is-here/
    55Description: Displays co-authors of a post. Uses custom fields (key=<code>coauthor</code>;value=user's username)
    6 Version: 1.5
     6Version: 1.7
    77Author: Eugen Rochko
    88Author URI: http://anime2.kokidokom.net/
     
    6868}
    6969
     70//Filter for the author archives, displaying collaborative posts there
     71//Input: $posts, the array of the filter the_posts
     72function wt_include_coauthors($posts) {
     73    global $wp_query;
     74    if(is_author()):
     75        $curauth = get_userdata($author->ID);
     76        $curauth_name = $curauth->user_login;
     77        $au_posts = get_posts('meta_key=coauthor&meta_value=' . $curauth_name);
     78        $all_posts = array_merge($posts, $au_posts);
     79        $all_posts = array_unique($all_posts);
     80        return $all_posts;
     81    else:
     82        return $posts;
     83    endif;
     84}
     85
    7086//The filtering, for automatisation.
    7187add_filter('the_author', 'wt_the_coauthors');
     88add_filter('the_posts', 'wt_include_coauthors', 1);
    7289
    7390?>
Note: See TracChangeset for help on using the changeset viewer.