$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>custom post types - Add HTML before a specific div?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

custom post types - Add HTML before a specific div?

matteradmin10PV0评论

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.

Share Improve this question asked Jan 8, 2019 at 21:17 Heinrich HeldHeinrich Held 791 gold badge1 silver badge7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default -1

Seems 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";
}
Post a comment

comment list (0)

  1. No comments so far