• 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

Difficulty Removing footer markup conditionally

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 › Difficulty Removing footer markup conditionally

This topic is: resolved

Tagged: conditional, footer, markup

  • This topic has 12 replies, 2 voices, and was last updated 11 years, 11 months ago by Brad Dalton.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • July 30, 2013 at 8:10 pm #53315
    Alessandra
    Member

    Hi!

    Would someone please help me out on this:

    I want the filter bellow to work only on posts and pages:

    //* Remove the entry footer markup (requires HTML5 theme support)
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );

    Tried to do with:

    if(is_single() || is_page()) {
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    }

    But had no success at all... It continues to output the markup and only works if i use without that conditional.

    I'm not an php guy... =/

    Any help will be more than appreciated.

    Best regards.

    July 30, 2013 at 11:07 pm #53319
    Brad Dalton
    Participant

    Use this code but change the conditional tag and the remove actions to suit your needs.

    https://gist.github.com/braddalton/5305974


    Tutorials for StudioPress Themes.

    July 30, 2013 at 11:34 pm #53322
    Alessandra
    Member

    Hello, Brad.

    Tried your code but unfortunately i got no results...

    I guess it is a pre html5 code, no?

    I used some variations too, but also could not managed it to work as expected.

    Used the "stock" version also, and it seems to do nothing, on my home page the footer markup keep showing normally with the unchanged code you suggested.

    I can get away with the footer markup with:

    //* Remove the entry footer markup (requires HTML5 theme support)
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    

    But then it removes the open and close tags globally, when i just want t remove them on single posts and pages.

    Any more suggestions please?

    July 31, 2013 at 12:54 am #53329
    Brad Dalton
    Participant

    Hi Charles

    I tested that code which i always do before publishing it and it works perfectly.

    Please note that the footer and footer widgets are different.

    If you want to remove both and the markup, please use this code and change the conditional tags

    The hooks outside the loop have not changed.


    Tutorials for StudioPress Themes.

    July 31, 2013 at 1:10 am #53331
    Brad Dalton
    Participant

    Please copy the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++


    Tutorials for StudioPress Themes.

    July 31, 2013 at 9:41 am #53399
    Alessandra
    Member

    The footer i mean is this:

    <footer class="entry-footer"></footer>

    And as i said before, this is the code that is said to get rid of these markups:

    //* Remove the entry footer markup (requires HTML5 theme support)
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );

    Using the above piece of code inside my functions removes this tags as i want. But it removes site-wide.

    I would like to have a way to remove them only on single posts and pages, cause i am already putting them with another hook on them.

    I saved the code you provided inside my functions.php but it dont remove the markup i am referring here. It is still there with this code and i think it relates to another different thing and we are not talking about the same thing.

    The action that filters the footer i meant is genesis_entry_footer_markup_open ..._close

    Any other help on how to use it as i need, working only on single posts and pages?

    Best regards.

    July 31, 2013 at 8:17 pm #53477
    Brad Dalton
    Participant

    As mentioned previously Charles, please change the conditional tag to suit your needs.

    The code i provided is tested and works.

    It removes the footer markup conditionally as well as the footer widgets.

    The conditional tags for pages and posts are:

    if ( is_single() || is_page( ) ) {
    

    This code will remove the footer and markup conditionally:

    The code you're referring to applies to the new HTML 5 loop hooks.

    http://www.briangardner.com/code/remove-entry-footer-markup/

    The genesis_entry_footer replaces the old XHTML genesis_after_post_content hook.

    Learn more about the hook changes http://www.briangardner.com/code/genesis-html5-loop-hooks/


    Tutorials for StudioPress Themes.

    July 31, 2013 at 8:36 pm #53483
    Brad Dalton
    Participant

    Can you please link to your site Charles so i can check a few things. Thanks.


    Tutorials for StudioPress Themes.

    July 31, 2013 at 9:14 pm #53487
    Alessandra
    Member

    I will try your code again right now, Brad.

    But the last time i used it as it is, and i can see it is setting the conditional to the home page, but checking my source code with the code inside my function.php i still had the markup on each post excerpt inside my home page and in itself.

    I am using the html5 support, should it work with it or maybe your code is not compatible with it?

    Maybe its me doing some foolish thing.

    Unfortunately theres no link, because i'm doing it on my localhost, inside my computer.

    I appreciate you help so much.

    Will repport here what i get from this.

    Thanks a lot!

    July 31, 2013 at 9:55 pm #53493
    Alessandra
    Member

    Brad, as i said before: we are talking about different footers.

    The footer your code removes is this one:

    <footer class="site-footer" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter"><div class="wrap"><p>Footer Content Goes Here Baby</p></div></footer></div>

    Its the last footer of the page.

    The footer i am referring to is the footer that comes right after the <div class="entry-content" itempro="tet">...</div>
    Its the footer of the post / page content, not the footer of the page.

    As i said, its this footer right here the one i want to remove the open and close tags only on single posts and pages.

    <footer class="entry-footer">...</footer>

    Your code works, but the one that controls the markup i want to get rid is this one:

    //* Remove the entry footer markup (requires HTML5 theme support)
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );

    If i use it as default, it removes the markup on single posts and pages, but also on my home page, categories and so on...

    I tried to adapt the code to this:

    function remove_only_single_page() {
    if ( is_single() || is_page( ) ) {
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    }}

    But it continues to output the footer markup in this case and only works with the default version... =/

    What i need is a way to make it work only on posts and pages.

    Maybe now you got my point.

    Could you or someone else please give me some help on how to adapt this code to work as i need it to?

    Thank you.

    July 31, 2013 at 11:05 pm #53500
    Brad Dalton
    Participant

    Your code is missing the function and hook

    add_action( 'genesis_before', 'wpsites_remove_footer_markup' );
    

    Try this:

    add_action( 'genesis_before', 'wpsites_remove_footer_markup' );
    function wpsites_remove_footer_markup() {
    if ( is_single() || is_page( ) ) {
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    }}
    

    Tutorials for StudioPress Themes.

    August 1, 2013 at 9:00 pm #53669
    Alessandra
    Member

    Thanks a lot, Brad!

    It worked!

    I'm a self taught on all this stuff and all i can do is through trial and error...

    I was not sure if the add_action( 'genesis_before', 'function_name_here' ); should be include in my case, thats why i had not used it before.

    But now it seems to be working just as i wished.

    And your help was vital to this.

    So thanks again, man! =)

    August 1, 2013 at 9:02 pm #53671
    Brad Dalton
    Participant

    Best way to learn Charles.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 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