WordPress.org

Support

Support » Plugins and Hacks » Co-Authors Plus » [Plugin: Co-Authors Plus] Feature: Iterator Filter

[Plugin: Co-Authors Plus] Feature: Iterator Filter

  • Co-authors-plus is a great plugin! Thanks for all the hard work.

    I would like to suggest one feature, a filter to the iterator. Currently I apply WP’s ‘the_author’ filter, but any filter hook would be very convenient.

    --- a/wp-content/plugins/co-authors-plus/template-tags.php
    +++ b/wp-content/plugins/co-authors-plus/template-tags.php
    @@ -145,6 +145,16 @@ function coauthors__echo( $tag, $type = 'tag', $separators = array(), $tag_args
     		if( empty( $author_text ) )
     			$author_text = $i->current_author->user_login;
    
    +		/*
    +		 * CUSTOMIZATION: Apply wordpress filter
    +		 */
    +		$author_text = apply_filters( 'the_author', $author_text );
    +		if ( empty( $author_text ) ) {
    +			$i->count = $i->count - 1;
    +			$i->position = $i-position - 1;
    +			continue;
    +		}
    +
     		// Append separators
     		if ( ! $i->is_first() && $i->count() > 2 )
     			$output .= $separators['between'];
Viewing 1 replies (of 1 total)
  • Plugin Author Daniel Bachhuber

    @danielbachhuber

    Sounds reasonable 🙂 Want to prepare a pull request for this on Github?

    My preference would be to apply a filter called ‘the_coauthor’, and then you can hook whatever you’d like onto that.

    Also, make sure your code actually executes (e.g. “$i-position” looks broken), and you can decrement with $i->position– or similar.

    Lastly, if you could prepare an example use case when you submit your pull request so I can properly test, that’d be wonderful.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Co-Authors Plus] Feature: Iterator Filter’ is closed to new replies.
Skip to toolbar