• Resolved iliafrescocom

    (@iliafrescocom)


    Store notice will not load – go to customizer, check box “show store notice” – customizer “milks out/reloads” as usual, but store notice will not load. I tried to disable plugins – no effect.
    running basic storefront theme – child (at the mean time i am running a small sale, so had to temporarily hardcode custom notice into header.php ofthe child theme…)

    i have another website running the same setup – storeront theme “deli” – left that one on 9.8.5 – all is good.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 16 through 26 (of 26 total)
  • Thread Starter iliafrescocom

    (@iliafrescocom)

    @shahzeenfarooq I have added this code to child-header. I do know that i can add it to codesnippet instead, jut wonder how do i hook it up to <body> tag instead of simply to

    add_action( ‘wp_head’, function () { ?>

    i have forgotten how to do that (indicate the positioning of the snippet), i will figure it out somehow, just though someone, just knows that by heart 🙂

    Hi @iliafrescocom

    Thanks for the follow-up. You’re right, using a code snippet plugin is a great alternative to hardcoding into your theme. The ability to control where the code runs—like hooking it into the <body> tag or other template locations—does depend on the plugin you’re using.

    If you’re using the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/) or Insert Headers and Footers (https://wordpress.org/plugins/insert-headers-and-footers/), both provide options to select where the snippet should be placed, such as in the header, footer, or site-wide frontend.

    If you’re trying to insert something directly into the <body> tag, you’d typically need to hook into wp_body_open if your theme supports it. Here’s a quick reference on that: https://developer.wordpress.org/reference/functions/wp_body_open/

    Let us know if you need any further support!

    Thread Starter iliafrescocom

    (@iliafrescocom)

    @lovingbro this below works as a code-snippet, using code-snippets plugin

    add_action( 'wp_head', function () { ?>


    <?php
    if ( function_exists( 'wp_body_open' ) ) {
    wp_body_open();
    }
    ?>
    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    Thanks for sharing that!

    Yes, the snippet you’ve provided works correctly when used with the Code Snippets plugin. It ensures that wp_body_open() is called properly, which is especially useful for themes that may not include it by default. This hook is often required by plugins or custom code that needs to inject content right after the <body> tag.

    We’d truly appreciate it if you could share your positive experience with others by leaving a 5-star review on WordPress.org: https://wordpress.org/support/plugin/woocommerce/reviews/#new-post

    For the record:

    Visible content belongs in <body>. It is not proper to put visible content in the <head> of an HTML document (for example, by hooking it to wp_head).

    Content placed in the <head> might still be displayed, because most modern browsers are lenient, but it’s considered poor practice and can lead to unexpected behavior. Also your markup may not validate.

    Hi @nothin7,

    Thank you once again for your valuable input — it’s truly appreciated.

    Since both you and @iliafrescocom are using WooCommerce, we’d be grateful if you could take a moment to leave a review sharing your experience with the support provided here, as well as the features you find most helpful in the WooCommerce plugin.

    You can leave your feedback here: https://wordpress.org/support/plugin/woocommerce/reviews/#new-post

    Thread Starter iliafrescocom

    (@iliafrescocom)

    @nothin7 =This is exactly what i was thinking asking the question here – i can put it into header.php after ,body> using child theme and in the header via codeSnippet using not proper way. I was wondering if someone here can help to make it proper as a code-snippet… so i can rid of the child theme.

    @iliafrescocom, I think you might be missing the point of action hooks in WordPress. For example, the wp_head action is included in (properly designed) theme template files to allow plugin authors and end users to hook code to the <head> of an HTML document without modifying the header.php template file directly. So if your theme is missing the standard wp_head action hook, the solution isn’t to find somewhere else to hook wp_head. There is nowhere else, if it doesn’t exist! The (one and only) solution is to put the wp_head action hook where it belongs—where it should have been in the first place.

    Same goes for the wp_body_open action. Why not add this where it’s supposed to be—in the header.php template file of the parent theme, immediately after the <body> tag? And notify the theme author so they can release an update to their theme to fix this problem for other people?

    If you are overriding header.php with your child theme, then sure, the code needs to be added there as well. If you want to get rid of your child theme, get rid of it, but there good reasons to always use a child theme.

    Thread Starter iliafrescocom

    (@iliafrescocom)

    @nothin7 Thank you for taking the time! You are correct, i do have a limited understanding.

    I used child theme before codesnippets became the thing – so the only function they served for me was to add some custom code to functions.php all css styling i did via small changes to custom css in customiser or lately via code snippets. This way i dont edit the theme files at all.

    Since this specific issue required adding code after body tag i have used the “remnant” of the child storefront that i had still there running empty (without any customizations)

    my other site running woo, also runs the storfront deli child them supplied by storefront people, so i had to use a codeSnippet in improper way to not edit the deli child (not advised by theme maker)…

    it is odd that storefront itself (and its child) does not have correct coding…

    @iliafrescocom the Storefront theme’s header.php file includes wp_body_open, and the Deli child theme does not include a header.php file, so it sounds like you (or someone who worked on your site) manually overrode the Storefront header template.

    The Deli child theme was abandoned in 2019, so you don’t have to worry about hardcoding any changes. But I would ditch it for a supported child theme (or make your own), which would remove your header.php override, thus solving your issue of wp_body_open being missing.

    Thread Starter iliafrescocom

    (@iliafrescocom)

    @nothin7 Thatis totally odd – no-one did (overwrite template) and wp_body_open is in storefront with Deli and Deli does not have header template. However it did not work until i added codesnippet (improperly…).

Viewing 11 replies - 16 through 26 (of 26 total)

The topic ‘Store Notice will not loadafter upgrade from 9.8.5 to 9.9.3’ is closed to new replies.