Per Page custom code

From old feedback: Per Page custom code | Cwicly

I like the ability, in Bricks, to add custom code (CSS, JS) on a page basis. It’s super convenient

Important to properly run custom code inside <head> and before closing <body> per page basis from FSE environment.

I think that Global Parts → Fragments are the way to go with this.
Our end goal is to have Template Parts, Stylesheets and JS available to add and condition in Global Fragments.

Interesting. The approach seems to be very smart, thanks for elaborating.
Gonna wait and see how it turns out.

What would be the best way to insert code in the head or before closing body tag?
Is this currently possible with Cwicly on a individual post/page basis inside the FSE environment?

Code block → wp_head and wp_footer :wink:

1 Like

Thanks for hinting @Louis, gonna check it out :+1:

For anyone interested:

add_action("wp_head", function () {
    echo '<script id="cwicly-header">console.log("Hello there, this is coming from the header")</script>';
add_action("wp_footer", function () {
    echo '<script id="cwicly-footer">console.log("Hello there from the footer")</script>';

From the code block, you can apply any Cwicly condition like for any other block. That should do the trick!

1 Like