• 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

Remove a note based on date

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 › Remove a note based on date

This topic is: not resolved

Tagged: comments, conditional, php

  • This topic has 6 replies, 3 voices, and was last updated 11 years, 7 months ago by SelenaD.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • June 18, 2014 at 6:09 pm #110449
    SelenaD
    Member

    I have added a note to the bottom of the comment form using the following code:

    // Add required text to bottom of comment form
    add_action ('genesis_after_comment_form', 'required_text_note');
    function required_text_note () {

    if ( is_single() && comments_open()) {
    ?>
    <div class="required_text_note">
    <p class="required">*</p><p class="required_note">Required field</p>
    </div>
    <?php
    }
    }

    This works great, except when comments are set to close after 14 days. Then the comment form goes away, but my note remains. How can I make the note disappear at the same time as the comments form?

    http://delaplex.com
    June 18, 2014 at 7:12 pm #110458
    Lauren @ OnceCoupled
    Member

    How are you with PHP? You could grab the publish date and compare it to the current date, then only show when the different is less than 14 days. Here's some links on that information:

    http://www.php.net//manual/en/function.date.php
    http://codex.wordpress.org/Function_Reference/the_date

    Best,
    Lauren


    We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com

    June 18, 2014 at 7:21 pm #110460
    Brad Dalton
    Participant

    I think what you need is something like a conditional tag used by the comment system which only displays your text for 14 days after the post is published.


    Tutorials for StudioPress Themes.

    June 18, 2014 at 7:59 pm #110468
    Brad Dalton
    Participant

    Another option is to change the hook so the note disappears when the form does by using a hook that executes within the comment form like comments note after. http://wpsites.net/web-design/modify-text-before-after-comment-form/


    Tutorials for StudioPress Themes.

    June 18, 2014 at 9:54 pm #110486
    Lauren @ OnceCoupled
    Member

    Ooh, I like that second option. Here am I, making life difficult for you Selena! 😉


    We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com

    June 18, 2014 at 10:16 pm #110490
    Brad Dalton
    Participant

    Where did you post the code?

    No need to use opening and closing PHP tags for custom functions.

    Try this code which i tested:

    https://gist.github.com/braddalton/6db753679867f6c6fcd0


    Tutorials for StudioPress Themes.

    June 19, 2014 at 8:26 am #110563
    SelenaD
    Member

    So I'm extremely ashamed to admit this, but you guys have been so helpful while I slept on the problem, that I have to confess. The original code I posted works - which uses the comments_open conditional tag. :-/ I was in the wrong client function file. And no matter how many times I changed the wrong functions file nothing was happening on the site in question. Hanging my head in shame.

    Thank you both for your efforts, and Brad, for telling me you had tested your code, because I might never have noticed otherwise. I knew it SHOULD work. Sorry to waste your time, but thanks as always for your help.

    LOVE you folks on Studiopress forums.

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

© 2026 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