So I now have all my portfolio entries assigned to a specific author and now I am looking to ensure those portfolio entries appear under the author post links (same as post entries).
So if you go on my author posts entries (link bellow) I would like to also list the portfolio entries. Ideally this would be done through the child theme.
Thanks!
Hey momon!
I am afraid this is not that easy. The author page query is a default wordpress query that does not include any custom post types like the “portfolio” post type. My first idea was to search for a plugin for that but it seems there are none. All I could come up with is a a bunch of tutorials that allow you to add a few filter functions to your functions.php file to add this:
eg: http://designpx.com/tutorials/custom-post-types-author-archive/ – you need to make sure to also add the “portfolio” post type to the post type array mentioned in the tutorial ;)
Cheers!
Kriesi
Thanks Kriesi for the find. Unfortunately it did not work, the author page was remain unchanged when I added the filter.
I tried this with portfolio as well as other custom post types I have setup and it did not work. I tried it also with ‘page’ as he suggests in the article also but that didn’t yield any different results. Seems like the function is not doing anything at all.
Hi!
Try changing the code shown in that link to this.
function enfold_customization_add_portfolios_to_author_query($query) {
if ($query->is_author)
$query->set( 'post_type', array('portfolio', 'post') );
remove_action( 'pre_get_posts', 'custom_post_author_archive' );
}
add_action('parse_query', 'enfold_customization_add_portfolios_to_author_query');
Cheers!
Elliott
Perfect, that worked!