{"id":2343,"date":"2023-01-23T17:09:20","date_gmt":"2023-01-23T16:09:20","guid":{"rendered":"https:\/\/buildyourweb.fr\/number-of-products-in-a-category-in-the-wordpress-menu\/"},"modified":"2023-01-26T15:09:00","modified_gmt":"2023-01-26T14:09:00","slug":"number-of-products-in-a-category-in-the-wordpress-menu","status":"publish","type":"post","link":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/","title":{"rendered":"Add product number of a category in the WordPress menu"},"content":{"rendered":"\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:25%\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:50%\">\n<h2 class=\"wp-block-heading\">Number of products in a category<\/h2>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-justify\">When a customer visits your website, you need to be able to give them useful information at first glance. Quand on parle d&#8217;un E-Commerce, les prix, les quantit\u00e9s, les nombre de produits ou encore les cat\u00e9gories de produits sont des informations vraiment utiles. They must therefore be quickly visible in the navigation of your website. We will therefore see in this article how to display the number of products in a category and add this information in your WordPress menu.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Overall process of realisation<\/h2>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-justify\">To achieve this, we will proceed as follows. You need to access the WordPress Menu Filter (the one with the Menu object and not the one with the menu HTML). Next, we will pass each of the items in the Menu object and check if the item is a Product category. Next, we will pass each of the items in the Menu object and check if the item is a Product category. Finally, simply add it to the end of the content of the active element. Complex? No, it&#8217;s quite simple, you&#8217;ll see!<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">1 &#8211; The WordPress Filter<\/h2>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-justify\">The filter we will use is: <mark style=\"background-color:#ffffff\" class=\"has-inline-color has-vivid-red-color\"><strong>&#8216;wp_nav_menu_objects&#8217;<\/strong><\/mark>. We will assign a <mark style=\"background-color:#ffffff\" class=\"has-inline-color has-vivid-red-color\"><strong>byw_add_product_count_to_menu()<\/strong><\/mark> function to it which will handle our workflow. 2 parameters are passed in this filter ($items and $args). To learn more about this function, you can see the documentation <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/wp_nav_menu_objects\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( &#039;wp_nav_menu_objects&#039;, &#039;byw_add_product_count_to_menu&#039;, 10, 2 );\n\nfunction byw_add_product_count_to_menu( $items, $args ) {\n    return $items;\n}\n\n<\/pre><\/div>\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">2 &#8211; The Audit Function <\/h2>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-justify\">The first thing is to check whether the menu is the main one. If this is the case, we create a foreach loop on the <strong>$items<\/strong>, we check that it is indeed a &#8220;Product&#8221; category. This is where things get complicated. The menu object does not retrieve the product category id but only the category title (in the Menu) and the category URL (for the link). We will therefore create a function that retrieves the <mark style=\"background-color:#ffffff\" class=\"has-inline-color has-vivid-red-color\"><strong>slug<\/strong><\/mark> from the URL. We check if the URL ends with a &#8216;\/&#8217; (just in case), then we transform the content of the URL into an array. We get the last (or second to last depending on the slash) value of the array and call another function to count. This gives us : <\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nfunction get_category_slug($url) {\n    if (str_ends_with($url, &#039;\/&#039;) ) {\n        $index = 2;\n    } else {\n        $index = 1;\n    }\n    $value = explode(&#039;\/&#039;, $url);\n    return count_products_in_category_by_slug($value&#x5B;count($value) - $index]);\n}\n<\/pre><\/div>\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">3 &#8211; The Counting Function <\/h2>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-justify\">Now that we have retrieved the category slug, we will use <mark style=\"background-color:#ffffff\" class=\"has-inline-color has-vivid-red-color\"><strong>WP_Query<\/strong><\/mark> to retrieve the number of products attached to this function. This gives us the following function:<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nfunction count_products_in_category_by_slug($category_slug) {\n    $category_id = get_term_by( &#039;slug&#039;, $category_slug, &#039;product_cat&#039; )-&gt;term_id;\n    $args = array(\n        &#039;post_type&#039; =&gt; &#039;product&#039;,\n        &#039;tax_query&#039; =&gt; array(\n            array(\n                &#039;taxonomy&#039; =&gt; &#039;product_cat&#039;,\n                &#039;field&#039;    =&gt; &#039;term_id&#039;,\n                &#039;terms&#039;    =&gt; $category_id,\n            ),\n        ),\n    );\n    $query = new WP_Query( $args );\n    return $query-&gt;found_posts;\n}\n<\/pre><\/div>\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">4 &#8211; The Function at the Global <\/h2>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-justify\">By combining these 3 code blocks, you will have the number of products attached to the categories in your Main Menu. You can also add a check if the number is 0 and not display it. Anyway, here is the full code:<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( &#039;wp_nav_menu_objects&#039;, &#039;byw_add_product_count_to_menu&#039;, 10, 2 );\n\nfunction byw_add_product_count_to_menu( $items, $args ) {\n    \/\/ V\u00e9rification si le menu est bien le principal.\n    if ( $args-&gt;theme_location == &#039;primary&#039; ) {\n        \/\/ On boucle sur chaque \u00e9l\u00e9ment du Menu\n        foreach ( $items as $item ) {\n            \/\/ V\u00e9rifie si l&#039;\u00e9l\u00e9ment de menu est une cat\u00e9gorie produit\n            if ( $item-&gt;object == &#039;product_cat&#039; ) {\n                $category_slug = get_category_slug($item-&gt;url);\n                \/\/ On compte le nombre de produits dans cette cat\u00e9gorie\n                \/\/$product_count = wp_count_posts( &#039;product&#039; )-&gt;publish;\n                \/\/ Et on Ajoute le nombre de produits \u00e0 l&#039;intitul\u00e9 de l&#039;\u00e9l\u00e9ment de menu entre deux ()\n                $item-&gt;title .= &#039; (&#039; . $category_slug. &#039;)&#039;;\n            }\n        }\n    }\n    return $items;\n}\n\nfunction get_category_slug($url) {\n    if (str_ends_with($url, &#039;\/&#039;) ) {\n        $index = 2;\n    } else {\n        $index = 1;\n    }\n    $value = explode(&#039;\/&#039;, $url);\n    return count_products_in_category_by_slug($value&#x5B;count($value) - $index]);\n}\n\nfunction count_products_in_category_by_slug($category_slug) {\n    $category_id = get_term_by( &#039;slug&#039;, $category_slug, &#039;product_cat&#039; )-&gt;term_id;\n    $args = array(\n        &#039;post_type&#039; =&gt; &#039;product&#039;,\n        &#039;tax_query&#039; =&gt; array(\n            array(\n                &#039;taxonomy&#039; =&gt; &#039;product_cat&#039;,\n                &#039;field&#039;    =&gt; &#039;term_id&#039;,\n                &#039;terms&#039;    =&gt; $category_id,\n            ),\n        ),\n    );\n    $query = new WP_Query( $args );\n    return $query-&gt;found_posts;\n}\n<\/pre><\/div>\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Visual rendering<\/h2>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"196\" style=\"aspect-ratio: 1330 \/ 196;\" width=\"1330\" autoplay=\"\" controls=\"\" loop=\"\" src=\"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/show-product-count.mov\" playsinline=\"\"><\/video><\/figure>\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-justify\">And that&#8217;s a neat feature. You can of course vary the type of categories to display a counter for your articles for example. In any case, don&#8217;t hesitate to post your comments if you have any questions. Otherwise you can also discover our <a href=\"https:\/\/buildyourweb.fr\/en\/shorturl-tracker-plugin\/\">ShortUrl Tracker Plugin<\/a> (to manage your short links from your website) and of course <a href=\"https:\/\/buildyourweb.fr\/en\/contact\/\">contact us<\/a> if you have a Website project!<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:25%\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"Display the number of Products in a category in its Wordpress Menu","protected":false},"author":1,"featured_media":2309,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_pingme":["1"],"_encloseme":["1"],"_yoast_wpseo_primary_category":["31"],"_top_nav_excluded":[""],"_cms_nav_minihome":[""],"logo_partenaire":[""],"_thumbnail_id":["2309"],"_last_translation_edit_mode":["translation-editor"],"_yoast_indexnow_last_ping":["1674741452"],"_carousel_realisation":["field_61c59f6276b6b"],"_titre_realisation":["field_61c5c85c54daf"],"_carousel_realisation_0_image":["field_61c59fe676b6c"],"carousel_realisation":["1"],"carousel_realisation_0_image":["2310"],"_yoast_wpseo_title":["Add the number of products in a Category %%sep%% %%sitename%%"],"_yoast_wpseo_metadesc":["Wordpress, how to know the Number of products in a category and then add it in the Main Menu of your Wordpress site."],"_yoast_wpseo_focuskw":["Number of products in a category"],"_yoast_wpseo_focuskeywords":["[{\"keyword\":\"produits dans une cat\u00e9gorie\",\"score\":\"good\"},{\"keyword\":\"Menu Wordpress nombre de produits\",\"score\":\"ok\"}]"],"ekit_post_views_count":["2677"]},"categories":[70],"tags":[],"class_list":["post-2343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-en"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Add the number of products in a Category | Build Your Web<\/title>\n<meta name=\"description\" content=\"Wordpress, how to know the Number of products in a category and then add it in the Main Menu of your Wordpress site.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add product number of a category in the Wordpress menu\" \/>\n<meta property=\"og:description\" content=\"Wordpress, how to know the Number of products in a category and then add it in the Main Menu of your Wordpress site.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/\" \/>\n<meta property=\"og:site_name\" content=\"Build Your Web\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-23T16:09:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-26T14:09:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"768\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin4938\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin4938\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/\"},\"author\":{\"name\":\"admin4938\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/cad788d2dfe43011cce6a23dea9df7bd\"},\"headline\":\"Add product number of a category in the WordPress menu\",\"datePublished\":\"2023-01-23T16:09:20+00:00\",\"dateModified\":\"2023-01-26T14:09:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/\"},\"wordCount\":529,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg\",\"articleSection\":[\"Wordpress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/\",\"url\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/\",\"name\":\"Add the number of products in a Category | Build Your Web\",\"isPartOf\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg\",\"datePublished\":\"2023-01-23T16:09:20+00:00\",\"dateModified\":\"2023-01-26T14:09:00+00:00\",\"author\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/cad788d2dfe43011cce6a23dea9df7bd\"},\"description\":\"Wordpress, how to know the Number of products in a category and then add it in the Main Menu of your Wordpress site.\",\"breadcrumb\":{\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage\",\"url\":\"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg\",\"contentUrl\":\"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg\",\"width\":768,\"height\":768,\"caption\":\"Nombre de produit dans une cat\u00e9gorie\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/buildyourweb.fr\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Add product number of a category in the WordPress menu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/#website\",\"url\":\"https:\/\/buildyourweb.fr\/en\/\",\"name\":\"Build Your Web\",\"description\":\"Construire votre Futur Ensemble\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/buildyourweb.fr\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/cad788d2dfe43011cce6a23dea9df7bd\",\"name\":\"admin4938\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/19186118b41996ba58dc28e2e167a2b4c92b7bd0836b5ef27541caa91bf71d6c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/19186118b41996ba58dc28e2e167a2b4c92b7bd0836b5ef27541caa91bf71d6c?s=96&d=mm&r=g\",\"caption\":\"admin4938\"},\"url\":\"https:\/\/buildyourweb.fr\/en\/author\/admin4938\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Add the number of products in a Category | Build Your Web","description":"Wordpress, how to know the Number of products in a category and then add it in the Main Menu of your Wordpress site.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/","og_locale":"en_US","og_type":"article","og_title":"Add product number of a category in the Wordpress menu","og_description":"Wordpress, how to know the Number of products in a category and then add it in the Main Menu of your Wordpress site.","og_url":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/","og_site_name":"Build Your Web","article_published_time":"2023-01-23T16:09:20+00:00","article_modified_time":"2023-01-26T14:09:00+00:00","og_image":[{"width":768,"height":768,"url":"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg","type":"image\/jpeg"}],"author":"admin4938","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin4938","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#article","isPartOf":{"@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/"},"author":{"name":"admin4938","@id":"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/cad788d2dfe43011cce6a23dea9df7bd"},"headline":"Add product number of a category in the WordPress menu","datePublished":"2023-01-23T16:09:20+00:00","dateModified":"2023-01-26T14:09:00+00:00","mainEntityOfPage":{"@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/"},"wordCount":529,"commentCount":0,"image":{"@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage"},"thumbnailUrl":"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg","articleSection":["Wordpress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/","url":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/","name":"Add the number of products in a Category | Build Your Web","isPartOf":{"@id":"https:\/\/buildyourweb.fr\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage"},"image":{"@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage"},"thumbnailUrl":"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg","datePublished":"2023-01-23T16:09:20+00:00","dateModified":"2023-01-26T14:09:00+00:00","author":{"@id":"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/cad788d2dfe43011cce6a23dea9df7bd"},"description":"Wordpress, how to know the Number of products in a category and then add it in the Main Menu of your Wordpress site.","breadcrumb":{"@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#primaryimage","url":"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg","contentUrl":"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg","width":768,"height":768,"caption":"Nombre de produit dans une cat\u00e9gorie"},{"@type":"BreadcrumbList","@id":"https:\/\/buildyourweb.fr\/en\/number-of-products-in-a-category-in-the-wordpress-menu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/buildyourweb.fr\/en\/"},{"@type":"ListItem","position":2,"name":"Add product number of a category in the WordPress menu"}]},{"@type":"WebSite","@id":"https:\/\/buildyourweb.fr\/en\/#website","url":"https:\/\/buildyourweb.fr\/en\/","name":"Build Your Web","description":"Construire votre Futur Ensemble","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/buildyourweb.fr\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/cad788d2dfe43011cce6a23dea9df7bd","name":"admin4938","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buildyourweb.fr\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/19186118b41996ba58dc28e2e167a2b4c92b7bd0836b5ef27541caa91bf71d6c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/19186118b41996ba58dc28e2e167a2b4c92b7bd0836b5ef27541caa91bf71d6c?s=96&d=mm&r=g","caption":"admin4938"},"url":"https:\/\/buildyourweb.fr\/en\/author\/admin4938\/"}]}},"jetpack_featured_media_url":"https:\/\/buildyourweb.fr\/wp-content\/uploads\/2023\/01\/Product-Count-1.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/posts\/2343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/comments?post=2343"}],"version-history":[{"count":4,"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/posts\/2343\/revisions"}],"predecessor-version":[{"id":2347,"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/posts\/2343\/revisions\/2347"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/media\/2309"}],"wp:attachment":[{"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/media?parent=2343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/categories?post=2343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buildyourweb.fr\/en\/wp-json\/wp\/v2\/tags?post=2343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}