admin管理员组文章数量:1122832
I want to add a button (that will open an INFO popup screen with info about a certain option in a woocommerce variable product), all that can be easily created with a plugin that converts the whole thing to a shortcode, the problem is to insert it into the products page, this will run on hundreds of products so i cannot simply add it on the HTML directly.
I will attach below the CSS code that works to add an IMAGE to where i want, but im guessing we cant use the "Content" CSS to add shortcodes or so i tried..
Please advice me how can i insert a shortcode in that EXACT location (that is only one of the lines that will use the INFO button, each variable title will get a different one)
.label [for=pa_size-of-product]:before {
content: url(shortcode would go here, but only images or text work with this option) !important;
}
Thanks!
I want to add a button (that will open an INFO popup screen with info about a certain option in a woocommerce variable product), all that can be easily created with a plugin that converts the whole thing to a shortcode, the problem is to insert it into the products page, this will run on hundreds of products so i cannot simply add it on the HTML directly.
I will attach below the CSS code that works to add an IMAGE to where i want, but im guessing we cant use the "Content" CSS to add shortcodes or so i tried..
Please advice me how can i insert a shortcode in that EXACT location (that is only one of the lines that will use the INFO button, each variable title will get a different one)
.label [for=pa_size-of-product]:before {
content: url(shortcode would go here, but only images or text work with this option) !important;
}
Thanks!
Share Improve this question edited Jun 15, 2019 at 15:23 Pratik Patel 1,1111 gold badge11 silver badges23 bronze badges asked Jun 14, 2019 at 21:49 Marcio da SilvaMarcio da Silva 11 silver badge1 bronze badge 3- It should be more helpful if you post an actual URL with place where you want to add the code. – twelvell Commented Jun 14, 2019 at 22:44
- H Twelvell, here is a link to a dummy product, basically i want to place the shortcode (which will be a button that opens a modal, created in Elementor Pro) in the place of the Facebook icon, which i placed there via CSS so you can easily see the spot i want, basically i will do the same on all the variable titles, with different shortcodes, thanks! – Marcio da Silva Commented Jun 15, 2019 at 9:01
- Forgot the link haha - back.frapids.pt/produto/test-01/… – Marcio da Silva Commented Jun 15, 2019 at 9:01
2 Answers
Reset to default 0You can’t do what you’re trying to do.
If you want to output a shortcode you need to do it in the content or template. You can’t place one with CSS.
in functions.php
echo '<style>.label [for=pa_size-of-product]:before {
content: "' . do_shortcode("[your-shortcode]") .'" !important;}</style>';
本文标签: phpAdd Shortcode to before class
版权声明:本文标题:php - Add Shortcode to ::before class 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736294591a1929391.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论