• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

how to exclude content in certain pages

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › how to exclude content in certain pages

This topic is: not resolved
  • This topic has 5 replies, 2 voices, and was last updated 10 years, 8 months ago by robortsmith.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • March 3, 2015 at 7:23 am #143028
    robortsmith
    Member

    Hi,

    I have a site http://www.southnewington.com that has a metaslider at the top. I added this by putting it in simple hooks in:
    genesis_before_content Hook

    Now I dont want this slider to appear in couple of pages.

    I can stop it appearing in one by changing the genesis_before_content Hook to:

    <?php
    if(!is_page(doom)) { ?>
    <div class="amsliderarea">[metaslider id=1311]</div>
    <?php }

    which works. However I have several pages under this main page that I dont want this slider to appear in.

    Whats the easiest way of doing this? Should I have added the slider in the first place in a custom template rather than in a hook? stupid question can pages have categories if so can I change that code to exclude categories of pages rather than a single page? whats the easiest way?

    Any help appreciated thanks!

    ( theme is modifies sample one )

    http://www.southnewington.com
    March 3, 2015 at 9:57 am #143043
    Christoph
    Member

    If you only want to exclude a few pages, you can use an array in your function:

    !is_page( array( 42, 'about-me', 'Contact' ) )


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 3, 2015 at 10:02 am #143045
    robortsmith
    Member

    thats prob easiest great thanks!

    for future reference re workflow would you recommend adding a slider in the hooks or as a template - is there a difference?

    March 4, 2015 at 7:28 am #143169
    robortsmith
    Member

    i so cant get this to work. ive tried an array, tried excluding templates etc am going round in circles.

    Christoph or anyone can you provide the exact php to go in simple hooks? I want to exclude the page doom and about and contact.

    Thanks ๐Ÿ™

    March 4, 2015 at 9:43 am #143182
    Christoph
    Member

    Can you post the code you are using?
    You have to use the exact slugs or the page-idยดs for the pages you want to exclude.
    Also, double-check that the box "execute php on this hook?" is selected.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 5, 2015 at 3:22 am #143264
    robortsmith
    Member

    Thanks - managed to get it to work by excluding the templates using:

    <?php if ( !(is_page_template( '_doom2.php' ) || is_page_template( 'doom.php' ) )) { ?>

    <div class="amsliderarea">[metaslider id=1586]</div>
    <?php } ?>

    but would be nice to know why the array didnt work and what i was doing wrong ๐Ÿ™

    pages were doom, how-did-we-get-here, introduction-to-doom,project-timeline

    thanks

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble