• Resolved fannshop

    (@fannshop)


    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 5 months, 1 week ago by fannshop.
    • This topic was modified 5 months, 1 week ago by fannshop.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author themifyme

    (@themifyme)

    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 – 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

    (@fannshop)

    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

    (@themifyme)

    Hi,

    You can inspect our filter demo here: 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

    (@fannshop)

    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.

    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 rendering

    add_action('wp_head', 'buffer_start');

    add_action('wp_footer', 'buffer_end');
    Plugin Author themifyme

    (@themifyme)

    Hi @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)
  • You must be logged in to reply to this topic.