• Resolved ncovello

    (@ncovello)


    Hello,

    We’re having some problems, we have some parent categories and child categories, and using this shortcode to show a child category:
    [adverts_list display=”list” posts_per_page=”20″ category=”immobilier-medecine-esthetique”]
    (changing the category for each tab)

    But the shortcode seems to pick up only the parent category (medecine-esthetique in this case) and we can’t figure it out.

    Also, in the “show categories widget” the number of ads its not right (check here:
    https://www.ebeautyplanet.fr/advert-category/produits-medecine-esthetique/ ) the parent category seems to add twice the amount of ads that are in (there are 4 ads in the childs categories, and in the parent says 8)

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    The problem is that you have the Ads in multiple categories, if you have a single Ad assigned to category Cosmetique and to category Cosmetique / Equipement, then Cosmetique will have count 2 and the the Cosmetique / Equipement will have count 1.

    Basically, WordPress will count how many assignments category has not how many items are inside it. This is also how a number of items is calculated in the default WP categories.

    If you would like to change how the items are count you can do that using adverts_category_post_count filter

    
    add_filter( "adverts_category_post_count", "my_adverts_category_post_count", 10, 2 );
    function my_adverts_category_post_count( $count, WP_Term $term ) {
      // recalculate numbr of items for a term
      return $count;
    }
    

    I am not about the first issue you had, i am looking at the page here https://www.ebeautyplanet.fr/advert-category/produits-medecine-esthetique/ and it lists a correct item?

    Thread Starter ncovello

    (@ncovello)

    Hello,
    Ok, I’ll check what you say about the ads count.

    On the first issue, in the “category page” its correct the amount of ads, the problem is when we use the shortcode with only one category

    Here is the shortcode on each tab with the different categories and everyone list everything on the parent category:
    https://www.ebeautyplanet.fr/annonces/medecine-esthetique/

    Plugin Author Greg Winiarski

    (@gwin)

    I am checking the link you pasted for about last 30 minutes but it does not seem to be loading? I am getting ERR_TIMED_OUT error in Chrome.

    Thread Starter ncovello

    (@ncovello)

    from my side is working fine:

    https://ebeautyplanet.fr/annonces/medecine-esthetique/

    please tell me if you keep with the same error, thank your

    Plugin Author Greg Winiarski

    (@gwin)

    Yes, i can access it now.

    So if i understand correctly the first tab here https://www.ebeautyplanet.fr/annonces/medecine-esthetique/ should only show the Ad https://www.ebeautyplanet.fr/advert/vend-divan-fauteuil/?

    Can you let me know what shortcode (with params) is this tab using?

    Thread Starter ncovello

    (@ncovello)

    Hello, we are using in the first tab (equipements) this one:

    [adverts_list display=”list” posts_per_page=”20″ category=”equipement-medecine-esthetique”]

    I’ve tried with the slug and with the id of the category, and happens the same (for ex. the chairs “mobilier” and the black one under “produit”)

    Plugin Author Greg Winiarski

    (@gwin)

    The “category” param accepts integers only, so the correct shortcode would be

    
    [adverts_list display="list" posts_per_page="20" category="1066"]
    

    The shortcode above should generate exactly the same list of Ads as the page here https://www.ebeautyplanet.fr/advert-category/equipement-medecine-esthetique/

    If not then try disabling any WPAdverts extensions or snippets you have installed on your site as they might be overwriting the tax_query param in WP_Query and see if it works.

    Thread Starter ncovello

    (@ncovello)

    Hello, now is working! thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Categories Issue’ is closed to new replies.