- This topic has 29 replies, 3 voices, and was last updated 6 years, 2 months ago by Tom.
September 14, 2017 at 10:38 am #385466Armando
I want to use the hooks to show header and footer across my website. So I tried inserting
“[elementor-template id=”1346″]” in before header, wp head and before header content. None works, but the page http://www.new.neighborhoodsun.solar/community/our-neighborhood/ shows the code at the top. This page http://www.new.neighborhoodsun.solar/community/who-we-are/ shows the code in the 3 hooks I placed it in.
Right now you can see the right header (and footer) already in most of the pages, as I added the elementor template in each page one by one.
I could do that for all pages, yet that solution doesn’t satisfy me as I ultimately want the header to be sticky and the “Sticky Menu (or Anything!)” plugin only allows one object at any time.
Any advice? Thank you a lot!September 14, 2017 at 2:54 pm #385590LeoStaffCustomer Support
Try this for the Elementor shortcode: https://generatepress.com/forums/topic/conditional-code-in-hook/#post-383652
You could try this for the fixed header: https://generatepress.com/forums/topic/how-can-i-create-a-fixed-header-and-top-menu-in-the-generate-press-theme/#post-31579
Although I’m not sure if it would work well as the header is from Elementor. If not you might want to ask them what’s the best way to accomplish that.September 14, 2017 at 6:38 pm #385666Armando
So should I insert this code
<?php if ( in_category( ‘hearing’ ) ) : ?>
<?php echo do_shortcode( ‘[elementor-template id=”1346″]’ ); ?>
<?php endif; ?>
in the “before header content” hook?
Thanks for your advice!September 14, 2017 at 8:34 pm #385697LeoStaffCustomer Support
Without the If statement.
<?php echo do_shortcode( ‘[elementor-template id=”1346″]’ ); ?>September 15, 2017 at 5:29 am #385883Armando
I inserted that code into “before header content” hook, and did the same for the footer in “after footer content with the element id “1572”.
It doesn’t show though, check the page http://www.new.neighborhoodsun.solar/community/learn-more/ I deleted the header and footer from this page as they should appear anyway because of the hooks. In all other pages where header and footer appear is because I pasted them from the elementor template.
What am I missing?
Thanks!September 15, 2017 at 8:16 am #385990LeoStaffCustomer Support
Did you check execute PHP?September 15, 2017 at 10:07 am #386071Armando
yes, all hooks have “execute php” checked, and “disable hook” is not checked.
I tried putting the code in different places, also doesn’t work. I checked again the IDs of the two elements, and they’re correct.
armandoSeptember 15, 2017 at 11:23 am #386105LeoStaffCustomer Support
Ahh wrong quotation mark I think. Try
<?php echo do_shortcode("[elementor-template id='1346']"); ?>September 15, 2017 at 12:03 pm #386137Armando
I don’t know Leo, it still doesn’t show it. I tried putting the code in different places, still elements are not there. Yet, you can see the code, like in http://www.new.neighborhoodsun.solar/community/uncategorized/hello-world/ (that page is not designed yet).
In most pages like this one http://www.new.neighborhoodsun.solar/community/our-neighborhood/ the elements show up as I plugged them in in each page singularly, but for example I removed them from http://www.new.neighborhoodsun.solar/community/learn-more/
“execute PHP” is flagged while “disable hook” is not, and that is on the “GP hooks” page under appearance. Is there maybe some other setting that makes the hooks disabled?September 15, 2017 at 7:58 pm #386302TomLead DeveloperLead Developer
Any chance you can send us temporary admin login details so we can take a look?: https://generatepress.com/contact/September 16, 2017 at 6:05 am #386438Armando
Thanks Tom, I sent them to you.September 16, 2017 at 10:15 am #386544TomLead DeveloperLead Developer
It looks like you’re using the Canvas page template, which strips the page of all theme related things, including hooks. If you want the hooks to show, you’ll need to use the regular Default page template.
Let me know if that helps or not 🙂September 16, 2017 at 10:28 am #386548Armando
Thanks Tom to have a look!
I updated to default template this page http://www.new.neighborhoodsun.solar/community/ and this other page http://www.new.neighborhoodsun.solar/community/learn-more/.
I can now see the shortcode on top (elementor ID…) and the names of the page (which I don’t want). But I can’t see the header/footer themselves.September 16, 2017 at 10:44 am #386551Armando
Also, if you are in the home and you hover over the menu, the pages that are nested in do not show 🙁September 16, 2017 at 8:41 pm #386692TomLead DeveloperLead Developer
As for the shortcode not working – it seems Elementor isn’t even showing the shortcodes to use in the Library area. I’m not familiar enough with Elementor to know why that would be. Maybe you have a conflicting plugin? You can try deactivating each plugin one by one to check.
- You must be logged in to reply to this topic.