• 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

Comment Policy Box

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 › Comment Policy Box

This topic is: not resolved
  • This topic has 4 replies, 4 voices, and was last updated 9 years, 7 months ago by Derek.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • November 15, 2012 at 9:07 pm #247
    Len
    Member

    Playing around with some code to implement a "comment policy box" as per the instructions found here. It works but with a minor problem: the text appears AFTER the list of comments and BEFORE the comment form, which is the expected behaviour. While this is fine if there are no comments or even just a couple of comments the problem comes into play if there are many comments. For instance, if there are say half dozen comments and someone clicks the "reply" button the comment form loads BUT the added text does not - it stays at the bottom of the page per the genesis_after_comments hook meaning it will never be seen.

    After perusing the old forum and visiting this Codex page I hobbled together the following:

    /** Add a comment policy box */
    add_filter('genesis_comment_form_args', 'custom_comment_form_args');
    function custom_comment_form_args($args) {
    	$args['comment_notes_before'] = '<p class="comment-policy">' . __( '<small><strong>Comment Policy:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</small>' ) . ( $req ? $required_text : '' ) . '</p>';
    	return $args;
    }

    This will add the given text right AFTER the Speak Your Mind heading or whatever making it a part of the comment form itself. This means of course it will be visible if someone clicks the reply button since it will load along with the comment form.

    My question: is the above correctly written? While it seems to work I want to make sure it is the proper way to write it.

    November 16, 2012 at 8:32 pm #392
    nickthegeek
    Member

    Looks good to me. Technically the HTML and translatable text should be separated using sprint() but I'm assuming you aren't even translating this, so I'd let it ride.

     

     

    November 17, 2012 at 11:22 am #442
    Len
    Member

    HTML and translatable text should be separated using sprint()

    Good catch! Thanks Nick!

    November 18, 2012 at 8:41 am #529
    Jon Weiss
    Member

    I like this. Nice snippet!


    View My Site – Two W Media.com | I’m a Recommended StudioPress Customizer

    November 18, 2012 at 2:07 pm #569
    Derek
    Member

    I just installed this code. Thank you Len.  (I was using the old code you originally linked to)


    ~’;’~

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

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