[Resolved] GP HOOKS (header and footer)

Home Forums Support [Resolved] GP HOOKS (header and footer)

Home Forums Support GP HOOKS (header and footer)

  • This topic has 29 replies, 3 voices, and was last updated 7 years ago by Tom.
Viewing 15 posts - 1 through 15 (of 30 total)
  • Author
    Posts
  • #385466
    Armando

    Hi,
    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!

    #385590
    Leo
    Staff
    Customer Support

    Hi there,

    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.

    #385666
    Armando

    Hi Leo,

    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!

    #385697
    Leo
    Staff
    Customer Support

    Without the If statement.

    Like this: <?php echo do_shortcode( β€˜[elementor-template id=”1346β€³]’ ); ?>

    #385883
    Armando

    Hey Leo,
    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!

    #385990
    Leo
    Staff
    Customer Support

    Did you check execute PHP?

    #386071
    Armando

    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.
    thanks,
    armando

    #386105
    Leo
    Staff
    Customer Support

    Ahh wrong quotation mark I think. Try

    <?php
        echo do_shortcode("[elementor-template id='1346']");
    ?>
    #386137
    Armando

    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?

    #386302
    Tom
    Lead Developer
    Lead Developer

    Any chance you can send us temporary admin login details so we can take a look?: https://generatepress.com/contact/

    #386438
    Armando

    Thanks Tom, I sent them to you.

    #386544
    Tom
    Lead Developer
    Lead 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 πŸ™‚

    #386548
    Armando

    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.

    #386551
    Armando

    Also, if you are in the home and you hover over the menu, the pages that are nested in do not show πŸ™

    #386692
    Tom
    Lead Developer
    Lead Developer

    The menu dropdowns aren’t working as you have a few javascript errors on the page – a couple related to a sticky sidebar plugin, and one from Elementor itself.

    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.

Viewing 15 posts - 1 through 15 (of 30 total)
  • You must be logged in to reply to this topic.