Title: Product count html error
Last modified: June 18, 2024

---

# Product count html error

 *  Resolved [fannshop](https://wordpress.org/support/users/fannshop/)
 * (@fannshop)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/product-count-html-error/)
 * When adding “product count” to either the horizontal, vertical or column layout
   the html output is wrong, there is missing <p> tag which results in displaying
   the span below the label…. How can I fix this i need to show the total product
   count per category. When hiding the total product count there is still a floating
   </p> tag without the starting <p>…. View source to see what I’m talking about.
 * I’ve also added margin-top: -100px because when adding the widget to the sidebar
   it adds a large space above, no idea why it does that….
 * Thanks for your help.
    -  This topic was modified 1 year, 11 months ago by [fannshop](https://wordpress.org/support/users/fannshop/).
    -  This topic was modified 1 year, 11 months ago by [fannshop](https://wordpress.org/support/users/fannshop/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fproduct-count-html-error%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [themifyme](https://wordpress.org/support/users/themifyme/)
 * (@themifyme)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/product-count-html-error/#post-17834215)
 * Hi,
 * There shouldn’t be any `<p>` tag in the product category count HTML markup. This
   could be generated by something else as the `<form>` tag also has invalid `<p
   >` and `<br>` tags: [https://share.zight.com/04u8WYv1](https://share.zight.com/04u8WYv1)–
   which is wrong HTML markups. Themify Product Filter doesn’t generate these tags.
   It could be generated Gutenberg editor due to autop issue. Double check the shortcode
   or HTML content where you have product filter shortcode inserted.
 *  Thread Starter [fannshop](https://wordpress.org/support/users/fannshop/)
 * (@fannshop)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/product-count-html-error/#post-17834539)
 * There shouldn’t be any <p> or closing </p> tags but there are, and those are 
   not added from the admin. So does this mean your plugin cannot be used on FSE
   Block themes only on classic themes? Too bad, in that case I’ll have to look 
   for another solution.
 *  Plugin Author [themifyme](https://wordpress.org/support/users/themifyme/)
 * (@themifyme)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/product-count-html-error/#post-17836566)
 * Hi,
 * You can inspect our filter demo here: [https://themify.org/wc-product-filter/](https://themify.org/wc-product-filter/),
   the filter is added using a Classic Text Widget, but if you could disable the
   auto `<p>` in your Block Editor that might help, else if it has a Classic Editor
   function you can try that instead, so it won’t add any tags automatically.
 *  Thread Starter [fannshop](https://wordpress.org/support/users/fannshop/)
 * (@fannshop)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/product-count-html-error/#post-17842078)
 * I’ve solved this using a function. Incase some else needs this I’m posting it
   here below. Add it to your functions.php it will remove the unwanted <p> </p>
   and leftover </p> tag in de sidebar instead of the content.
 *     ```wp-block-code
       function fannshop_remove_unwanted_p_tags($content) {    // Remove closing </p> tags that appear right before </li>    $content = preg_replace('/<\/label><\/p>/', '</label>', $content);    // Remove opening <p> tags that appear right before <span class="wpf_item_count">    $content = preg_replace('/<p>\s*(<span class="wpf_item_count">)/', '$1', $content);    // Remove closing </p> tags that appear right after </span>    $content = preg_replace('/(<\/span>)\s*<\/p>/', '$1', $content);    return $content;}function buffer_start() {    ob_start('remove_unwanted_p_tags');}function buffer_end() {    ob_end_flush();}// Hook into the template renderingadd_action('wp_head', 'buffer_start');add_action('wp_footer', 'buffer_end');
       ```
   
 *  Plugin Author [themifyme](https://wordpress.org/support/users/themifyme/)
 * (@themifyme)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/product-count-html-error/#post-17847045)
 * Hi [@fannshop](https://wordpress.org/support/users/fannshop/)
 * I’m glad it’s resolved and thank you for sharing your solution!
 * Have a good day!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Product count html error’ is closed to new replies.

 * ![](https://ps.w.org/themify-wc-product-filter/assets/icon-128x128.png?rev=1535808)
 * [Themify - WooCommerce Product Filter](https://wordpress.org/plugins/themify-wc-product-filter/)
 * [Support Threads](https://wordpress.org/support/plugin/themify-wc-product-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/themify-wc-product-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/themify-wc-product-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/themify-wc-product-filter/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [themifyme](https://wordpress.org/support/users/themifyme/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/product-count-html-error/#post-17847045)
 * Status: resolved