admin管理员组文章数量:1130349
I bought the "Woocommere Checkout Add-Ons" Plugin, which adds upsells to the checkout page - but it only allows to place text after the upsell checkbox.
So I got the idea to add an image with some styled text just above that upsell checkbox, which is wrapped in <div id="wc_checkout_add_ons">.
How would I do this? I read about the_contentbut can't quite figure it out.
I bought the "Woocommere Checkout Add-Ons" Plugin, which adds upsells to the checkout page - but it only allows to place text after the upsell checkbox.
So I got the idea to add an image with some styled text just above that upsell checkbox, which is wrapped in <div id="wc_checkout_add_ons">.
How would I do this? I read about the_contentbut can't quite figure it out.
1 Answer
Reset to default -1Seems like jQuery is best for this case. Mainly answering for myself in case I'll need it again in the future:
<head>
<script src="https://ajax.googleapis/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#this_comes_before").insertBefore("#wc_checkout_add_ons");
});
</script>
</head>
<body>
<div id="wc_checkout_add_ons">stuff</div>
<div id="this_comes_before">something</div>
</body>
Edit for future me:
Use this instead you lazy asshole...
add_action( 'woocommerce_checkout_after_customer_details', 'test99' );
function test99() {
echo "your shit";
}
I bought the "Woocommere Checkout Add-Ons" Plugin, which adds upsells to the checkout page - but it only allows to place text after the upsell checkbox.
So I got the idea to add an image with some styled text just above that upsell checkbox, which is wrapped in <div id="wc_checkout_add_ons">.
How would I do this? I read about the_contentbut can't quite figure it out.
I bought the "Woocommere Checkout Add-Ons" Plugin, which adds upsells to the checkout page - but it only allows to place text after the upsell checkbox.
So I got the idea to add an image with some styled text just above that upsell checkbox, which is wrapped in <div id="wc_checkout_add_ons">.
How would I do this? I read about the_contentbut can't quite figure it out.
1 Answer
Reset to default -1Seems like jQuery is best for this case. Mainly answering for myself in case I'll need it again in the future:
<head>
<script src="https://ajax.googleapis/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#this_comes_before").insertBefore("#wc_checkout_add_ons");
});
</script>
</head>
<body>
<div id="wc_checkout_add_ons">stuff</div>
<div id="this_comes_before">something</div>
</body>
Edit for future me:
Use this instead you lazy asshole...
add_action( 'woocommerce_checkout_after_customer_details', 'test99' );
function test99() {
echo "your shit";
}
本文标签: custom post typesAdd HTML before a specific div
版权声明:本文标题:custom post types - Add HTML before a specific div? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749027372a2305316.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论