[Resolved] Hooks on Single Page and Posts but not homepage

Home Forums Support [Resolved] Hooks on Single Page and Posts but not homepage

Home Forums Support Hooks on Single Page and Posts but not homepage

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #554899
    steven

    Hey-

    I’m using GeneratePress and Elementor to build my site.

    I’ve created a page title section in Elementor and I’d like for it to display on my single pages and single posts, but not the homepage or archives.

    I’ve tried several solutions listed in the forums, but the title keeps popping up on my homepage and I can’t seem to get it to go away.

    This is the code, I’ve worked out and placed in GP Hooks under Inside Content Container:

    <?php if (is_single() || is_page()):
        echo do_shortcode( '[elementor-template id="3692"]' );
    else:
        echo " " ;
    endif; 
    ?>

    Any help at this point would be awesome!

    #555306
    Leo
    Staff
    Customer Support

    Hi there,

    Try this:

    <?php if ( ! is_front_page() && ! is_archive() ) : ?>
        echo do_shortcode( '[elementor-template id="3692"]' );
    <?php endif; ?>

    Let me know.

    #555575
    steven

    Close enough!

    The second line was missing the opening and closing PHP tags, but I just combined into one tag and it worked like a charm:

    <?php if ( ! is_front_page() && ! is_archive() ) : 
        echo do_shortcode( '[elementor-template id="3692"]' );
     endif; ?>

    Thanks for the help!

    #555811
    Leo
    Staff
    Customer Support

    No problem 🙂

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