Author page not counting custom posts

Posted in: Newsmag
Post count: 93

Hi the author page has
<?php echo count_user_posts($part_cur_auth_obj->ID). ' ' . __td('POSTS');?>

It doesn’t count custom post types, i’ve been looking for hours but couldn’t find a working method that count many post types. Any idea appreciated.

Post count: 93

ANSWER: Edit /wp-content/themes/Newsmag/parts/page-author-box.php

Find:(line 20 approx)
<?php echo count_user_posts($part_cur_auth_obj->ID). ‘ ‘ . __td(‘POSTS’);?>`
Replace with:
<?php echo count_user_posts(
$userid = $part_cur_auth_obj->ID,
$post_type = [ 'post', 'page', 'cpt-1', 'cpt-2', 'cpt-n' ],
$public_only = false
). " POSTS";?>

Post count: 6535

Hi

Glad you managed to find a solution.
Thanks for letting us know and for sharing your solution here.

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newsmag’ is closed to new topics and replies.