Custom post type support for get_users and ( get_author_posts_url( $user->ID );

I’m creating a knowledge base using a plugin and am stuggling to create a page listing authors with a link to their posts. The plugin uses a custom post type (epkb_post_type_1) for articles. The theme I’m using has a contributors template for listing authors and so far I’ve adapted this with with the help of of Custom post type support for get_users(‘orderby=post_count’) to show knowledge base authors…

[functions.php]

function user_query_count_post_type($args){
$args->query_from = str_replace(“post_type = ‘post’ AND”, “post_type IN (‘post’,’epkb_post_type_1′) AND “, $args->query_from);

[template-contributors.php]

add_action(‘pre_user_query’,’user_query_count_post_type’);
$users = get_users(‘orderby=post_count’);
remove_action(‘pre_user_query’,’user_query_count_post_type’);

…. however, links to their posts are not displaying. The code for this in the contributors template is:

<a href=”<?php echo esc_url( get_author_posts_url( $user->ID ) ); ?>”><i class=”fa fa-pencil-square-o”></i> <?php esc_html_e( ‘All Posts’, ‘lenscap’ ); ?></a>

How can I get the template to display links to the author’s custom post types?

Read more here:: ID );” rel=nofollow>Custom post type support for get_users and ( get_author_posts_url( $user->ID );

Leave a Reply

Your email address will not be published. Required fields are marked *