Skip to content

Instantly share code, notes, and snippets.

@daggerhart
Last active March 6, 2018 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save daggerhart/10414715 to your computer and use it in GitHub Desktop.
Save daggerhart/10414715 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Coauthors Plus QW Field
Description: Example of coauthors custom Query Wrangler field
Author: Jonathan Daggerhart
Version: 1.0
*/
add_filter('qw_fields', 'coauthors_plus_qw_field');
function coauthors_plus_qw_field($fields)
{
$fields['coauthors_post_links'] = array(
'title' => 'Coauthor Posts Links',
'description' => 'Outputs the co-authors display names, with links to their posts.',
// If the coauthors plugin didn't echo the data by default we wouldn't even need this custom function,
// we could have set the output_callback to 'coauthors_posts_links' instead.
'output_callback' => 'get_coauthors_posts_links',
);
return $fields;
}
/*
* http://vip.wordpress.com/documentation/incorporate-co-authors-plus-template-tags-into-your-theme/#available-template-tags
*/
function get_coauthors_posts_links(){
return coauthors_posts_links(null,null,null,null,false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment