I am trying to get posts with an author's ID as a meta value in the author.php template using additional request parameter.
For example I want posts with john's ID as a meta value using a request like this
http://localhost:8888/twitgreen/author/john/?eco=somemetakey
So far I can make it using a new WP_query in author.php like this
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
if($_GET['eco']=='somemetakey'){
$lot = array(
'meta_query' => array(
array(
'key' => 'somemetakey',
'value' => $current_view->ID
)
),
'post_type'=>'lot',
'paged'=>$paged ,
);
}
$wp_query = new WP_Query($lot);
//and some loop here
<nav id="nav-below">
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'clonecell' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'clonecell' ) ); ?></div>
</nav><!-- #nav-below -->
But unfortunately it doesn't work on the next pages. The URL, http://localhost:8888/twitgreen/author/verifikator/page/2/?eco=somemetakey points to the 404 page.
The Question
- How can I query posts with an author's ID as a meta value in the author.php?
- How can I query posts with an authors's ID as a meta value or post from that author in author.php?
- How can I do this requests using WordPress hooks?
Thank you in advance.