-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I use HTML in the Badge text field in the admin panel? #18
Comments
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. |
Thanks, @CharlieEtienne, Do you have any guidance on how to do it? |
Wait, I'm not sure of what I told in my previous message... Let me check. |
I was completely wrong, sorry. I was thinking to another plugin. The HTML is actually escaped in my plugin, in Could you try this code (in your theme's global $post, $product;
add_filter('wcsob_soldout', function($content) {
return htmlspecialchars_decode($content, ENT_QUOTES);
}, $post, $product); |
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); |
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: |
You're welcome! |
Hi,
Can I use HTML in the Badge text field in the admin panel?
If I use HTML it shows the entered value as plain text:
For example, for a badge that looks like this:
I want to set it like this:
I did some research and found a document like this, but I couldn't get a successful result:
https://carbonfields.net/docs/fields-html/
Thank you for your support.
The text was updated successfully, but these errors were encountered: