Giter VIP home page Giter VIP logo

Comments (8)

CharlieEtienne avatar CharlieEtienne commented on June 26, 2024 1

I was completely wrong, sorry. I was thinking to another plugin. The HTML is actually escaped in my plugin, in wp-content/plugins/sold-out-badge-for-woocommerce/classes/Settings.php on line 125.

Could you try this code (in your theme's functions.php for example) and let me know if it works?

global $post, $product;
add_filter('wcsob_soldout', function($content) {
    return htmlspecialchars_decode($content, ENT_QUOTES);
}, $post, $product);

from sold-out-badge-for-woocommerce.

CharlieEtienne avatar CharlieEtienne commented on June 26, 2024 1

Yes, I forgot to specify the number of arguments. This is the right function to use:

global $post, $product;
add_filter('wcsob_soldout', function ($content, $post, $product) {
	return htmlspecialchars_decode($content, ENT_QUOTES);
}, 10, 3);

from sold-out-badge-for-woocommerce.

muhyal avatar muhyal commented on June 26, 2024 1

You've probably heard this a lot in your life @CharlieEtienne . "You are a great person" :) Thanks for your support.

Looks just like we imagined:

2022-09-08_15-56-31

from sold-out-badge-for-woocommerce.

CharlieEtienne avatar CharlieEtienne commented on June 26, 2024

Hi @muhyal,

In fact this is not a limitation of carbon fields or my plugin, but a limitation from WooCommerce. The hook used to display the badge is escaping html.

So the workarounds would be to override the products pages in your theme, or to replace WC hook.

from sold-out-badge-for-woocommerce.

muhyal avatar muhyal commented on June 26, 2024

Thanks, @CharlieEtienne,

Do you have any guidance on how to do it?

from sold-out-badge-for-woocommerce.

CharlieEtienne avatar CharlieEtienne commented on June 26, 2024

Wait, I'm not sure of what I told in my previous message... Let me check.

from sold-out-badge-for-woocommerce.

muhyal avatar muhyal commented on June 26, 2024

I tested it but this time the theme is broken.

It looks like this:

2022-09-08_11-07-19

from sold-out-badge-for-woocommerce.

CharlieEtienne avatar CharlieEtienne commented on June 26, 2024

You're welcome!

from sold-out-badge-for-woocommerce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.