• Hi,

    I get the number of favorites in javascript and show it in navigation.
    So each clic increase or decrease the total.

    But I sometime get weird results. For exemple, after one day, total is different from the number of favorite shown by the_user_favorites_list().

    Configuration: anonymous users et cookies.

    I get results with this script :

    <script type=”text/javascript”>var count = <?php echo the_user_favorites_count();?></script>
    <span class=”compteur”><?php the_total_favorites_count(); ?></span>

    Updating it with:

    jQuery(document).on(‘favorites-updated-single’, function(event, favorites, post_id, site_id, status){
    if (status == ‘active’) {count++;}
    else {count–;}
    jQuery(‘.compteur’).text(count);
    });

    Did i miss something?
    Is there a way to get the cookie value of the total of favorites?

    Thanks

  • The topic ‘How to get the cookie value of number of favorites ?’ is closed to new replies.