Thanks, Calin. I came across that and tried the solution but the code seems broken when I try to add it to functions.php, specifically, 'orderby’ => 'title',
add_filter('abh_author_latest_posts', function($query){
$args = array(
'post_type' => 'services',
'post_status' => 'publish',
'posts_per_page' => 5,
'orderby’ => 'title',
'order’ => 'ASC',
);
return new WP_Query( $args );
});
@calinvingan Following up on this, please let me know if you have any alternate ideas as the snippet you provided doesn’t seem to be working.
Be careful for the apostrophe to not be converted:
add_filter('abh_author_latest_posts', function($query){
$args = array(
'post_type' => 'services',
'post_status' => 'publish',
'posts_per_page' => 5,
'orderby' => 'title',
'order' => 'ASC',
);
return new WP_Query( $args );
});
I checked the code and it’s correct.
@calinvingan actually, sorry, now it’s fetching all of the latest posts for that post type regardless of author.
I’m looking to just add a new post type (rcno_review) so that that post type is fetched for each author.
add_filter('abh_author_latest_posts', function($query){
global $post;
if(isset($post->ID)){
$args = array(
'post_type' => 'rcno_review',
'author' => $post->post_author,
'post_status' => 'publish',
'posts_per_page' => 5,
'orderby' => 'title',
'order' => 'ASC',
);
return new WP_Query( $args );
}
return $query;
});
-
This reply was modified 3 years, 11 months ago by
Calin Vingan.