Current Author outside of loop
-
I’m using the Soliloquy plugin for featured content on the author.php page. I would like to show only posts from the author, however this code to do that resides outside of the loop. I’ve tried a couple of suggested options for calling the author outside the loop, but nothing seems to be working.
What should I be adding here? The suggested code from the plugin hardcodes the ID which I do not want, since each author page should display content from just that author.
<?php /** * Add Author Arguments to Featured Content Queries * * @param string $html HTML Link * @param obj $post WP_Post * @param array $data Slider Configuration * @return string HTML Link */ function soliloquy_fc_custom_author( $query_args, $id, $data ) { // You could check for a specific slider ID here, if you only want // to amend your FC query on a single slider. if ( 38119 !== $id ) { return $query_args; } // $query_args is an array for WP_Query: // http://codex.wordpress.org/Class_Reference/WP_Query $query_args['author__in'] = array( 1, 2 ); // Only get Posts that belong to User IDs 1 or 2 // Return query arguments return $query_args; } add_filter( 'soliloquy_fc_query_args', 'soliloquy_fc_custom_author', 10, 3 );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Current Author outside of loop’ is closed to new replies.