• Resolved Stephen S

    (@ssuess)


    Your code was not returning a correct category count on the category page. I have changed your code to fix it.

    Here is your original code:

    $travelera_cat = get_the_category();
    $travelera_cat = $travelera_cat[0];
    $travelera_cat_count = $travelera_cat->category_count;
    printf( _n( '%s Article', '%s Articles', intval( $travelera_cat_count ), 'travelera-lite' ), intval( $travelera_cat_count ) );

    And here is code that works:

    $idObj = get_category_by_slug(single_cat_title( '', false )); 
     $thisid = $idObj->term_id;
     $travelera_cat = get_category($thisid);
     $travelera_cat_count = $travelera_cat->count;
     printf( _n( '%s Article', '%s Articles', intval( $travelera_cat_count ), 'travelera-lite' ), intval( $travelera_cat_count ) );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author BloomPixel

    (@bloompixel)

    Hi Stephen

    Thank you for reporting the issue and also for providing the fix. I have just pushed an update for the same.

    Thank you

    Thread Starter Stephen S

    (@ssuess)

    You are very welcome, thanks for the excellent theme. ??

    Theme Author BloomPixel

    (@bloompixel)

    Hi Stephen

    If you’re happy with the theme, please help by rating 5 stars and leave an awesome feedback.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Category count wrong’ is closed to new replies.