Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1: Website canvas container is not a direct child of the HTML body tag. 2: Off-Canvas Sidebars are not direct children of the HTML body tag #109

Closed
jcashby opened this issue Nov 7, 2021 · 17 comments
Labels

Comments

@jcashby
Copy link

jcashby commented Nov 7, 2021

Hi, I keep getting the issues below:

1: Website canvas container is not a direct child of the HTML body tag.
2: Off-Canvas Sidebars are not direct children of the HTML body tag

I have added the code in the header and the footer as per the below:

<body>

and in the footer as below:

<?php wp_footer(); ?>

the website is a test one for now and this was working previously but for some reason, it no longer allows for the offcanvas sidebar to slide open in mobile view

https://giftexperttest.wpengine.com/birthday-gifts/1st-birthday-gifts/

any help would be greatly appreciated.

James

@JoryHogeveen
Copy link
Owner

Hi @jcashby

In the link you've send I see an element bodyclass so I'm guessing there is a space missing in your header.
Please fix that part first!

Cheers, Jory

@jcashby
Copy link
Author

jcashby commented Nov 8, 2021

Hi Jory,

Thanks for the quick response. I'm not an expert coder unfortunately so not sure what you meant with the space missing in the header. This is where I have placed the code - see attachment. Sorry I didn't realise it would translate the code above.

Was there something wrong in the body element

That's the only place 'body' is on the header.php fil
Capture
e

@JoryHogeveen
Copy link
Owner

Hi @jcashby

I see the issue.
Please add a space after <body (before <?php).

@jcashby
Copy link
Author

jcashby commented Nov 8, 2021

Hi, I added that in but it didn't seem to have changed anything (unless I added the space in the wrong place?).

Capture

@JoryHogeveen
Copy link
Owner

I still see the same issue online, did you update the actual server file?

@jcashby
Copy link
Author

jcashby commented Nov 8, 2021

Hi, yes it updates straight away. This is also my OCS settings
Capture

@JoryHogeveen
Copy link
Owner

From what I see it doesn't, I still see the element <bodyclass when I look at your site

@jcashby
Copy link
Author

jcashby commented Nov 8, 2021

I added an underscore and it's showing there but it didn't resolve the problem and I tried with a space before that.
Capture

@JoryHogeveen
Copy link
Owner

I just looked again, and now it's good, with a space! :)

However, I do notice that the footer isn't loaded where it should be loaded.
At this moment it's loaded within the canvas container.

This is probably because the original theme has added <?php wp_footer(); ?> within the closing div for the st-container element.

Could you share your footer.php code?

@jcashby
Copy link
Author

jcashby commented Nov 8, 2021

That's good :) please see below for the footer

Capture

@JoryHogeveen
Copy link
Owner

JoryHogeveen commented Nov 8, 2021

Hmm that looks fine oddly enough.
Not sure why the off-canvas sidebars are within the canvas container then.
What theme are you using? Is it an older one? Do they still offer support, if they do, it might be useful to ask what is hooked into the wp_footer.

You could also try to use wp_footer as the website_after hook in the plugin settings

@jcashby
Copy link
Author

jcashby commented Nov 8, 2021

Just tried adding wp_footer in (but I haven't changed anything else in the code yet unless I need too?). I use shopkeeper by themeforest. I think my support is well outdated now unfortunately.

Capture

@JoryHogeveen
Copy link
Owner

JoryHogeveen commented Nov 9, 2021

Hi @jcashby

I use shopkeeper by themeforest.

Themeforest isn't the theme developer, it's the marketplace. From what I know about Themeforest you should still receive updates once you purchase a product. You should definitely update to the latest version.
Last update was in July this year:

You shouldn't need to change anything in your code if your theme is compatible. Most themes are compatible with only known issues with JavaScript (unrelated to these hooks).

If you take a look at your site's code through the element inspector of your browser you'll see that the sidebar element is within your container like so:

<div id="ocs-site" ...>
    <div id="st-container" ...></div>
    <div id="ocs-mobile-4" ...></div>
    ... other scripts and elements.
</div>

This is incorrect, it should be like this:

<div id="ocs-site" ...>
    <div id="st-container" ...></div>
</div>
<div id="ocs-mobile-4" ...></div>
... other scripts and elements.

Despite the above I also see JavaScript errors. Slidebars cannot initialize for some reason. It looks like it's an issue with your script minifier.

@jcashby
Copy link
Author

jcashby commented Nov 9, 2021

That's interesting. It did previously work for me on Shopkeeper so I'm not sure what has changed. My account has been locked from Envato as someone hacked my account and paid for some applications on there apparently so I'm just waiting to get that back before I can update the theme. I'm on Version 2.9.28. As soon as i can update my theme, I will. I'll also see what else I can do, maybe it's a third party plugin or some other settings I have?

As you say maybe I have stopped script running with Wp Rocket or something similar but I've just deactivated that plugin and it didn't seem to change anything.

@jcashby
Copy link
Author

jcashby commented Nov 9, 2021

just sent you an email on your website email listed in profile

@jcashby
Copy link
Author

jcashby commented Nov 13, 2021

After a lot of troubleshooting. I reverted back to v0.4 and it worked! So I'm not sure whether other people are also having similar issues but it must be something in the new updates that has a conflict somewhere as the set-up in the header / footer is fine. Maybe it is a particular plugin it conflicts with but I also uninstalled pretty much every plugin first, then went through JS troubleshooting. But either way, I'll keep it at this version, thanks.

@JoryHogeveen
Copy link
Owner

as the set-up in the header / footer is fine.

Sorry but last time I checked your website the hooks setup was not fine (just checked again). It was incorrect according to the requirements of this plugin. The fact that it works with a previous version doesn't change this.

Keeping it on v0.4 is of course your own decision :) My advice is to find a correct way to implement the correct hooks in your theme (new or existing).

Closing this topic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants