Hi @lfbender
Thanks for your question.
Unfortunately, this plugin doesn’t have that option now.
Could you please let me know for future reference.
Are you looking for the number of the user’s own favorites, as in this shortcode ([ccc_my_favorite_list_menu]) ?
Or is it the total number including other users ?
custom template
This is part of a sample code to write in “your-theme/functions.php”.
function ccc_my_favorite_list_custom_template( $my_favorite_post_id=false ) {
$args= array(
'post_type' => 'any',
'post__in' => $my_favorite_post_id,
'orderby' => 'post__in',
'posts_per_page' => -1,
);
$the_query = new WP_Query($args);
shortcode: [ccc_my_favorite_list_custom_template]
Please see the related topic for usage.
Please, try it.
Thanks
Hi @takashimatsuyama and thanks for the answer.
I am already using the custom template.
Yes, I would be interested in only the number of saved posts for the user and to display that number on an archive page saying, “You have saved 3 favorites”.
Hi @lfbender
Thank you for your reply.
Please, try this.
function ccc_my_favorite_list_custom_template( $my_favorite_post_id=false ) {
$args= array(
'post_type' => 'any',
'post__in' => $my_favorite_post_id,
'orderby' => 'post__in',
'posts_per_page' => -1,
);
$the_query = new WP_Query($args);
if( $the_query->have_posts() ) {
?>
<p id="ccc-favorite-count">You have saved <span class="number"><?php echo $the_query->post_count; ?></span> favorites</p>
<div data-ccc_favorite-delete_all=true><a href="#" class="ccc-favorite-post-delete-button">All Delete</a></div>
<?php
while( $the_query->have_posts() ) {
$the_query->the_post();
?>
<div class="list-ccc_favorite">
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<div class="ccc-favorite-post-toggle"><a href="#" class="ccc-favorite-post-toggle-button" data-post_id-ccc_favorite="<?php echo $the_query->post->ID; ?>"></a></div>
</div>
<?php
} //endwhile
} //endif
} // endfunction
shortcode: [ccc_my_favorite_list_custom_template]
Key Points: <p id="ccc-favorite-count">You have saved <span class="number"><?php echo $the_query->post_count; ?></span> favorites</p>
If this isn’t the right solution, please let me know again.
Thanks