Site logo

Archived topic

Modify Comment area layout

12 replies · Started by Aditya on September 29, 2016

Viewing posts 1–13 of 13

I am trying to replicate the comment box layout at - http://backlinko.com/seo-tools (bottom of the page).

1) How do I add the line "Your email address will not be published. Required fields are marked *" below Leave a comment line?

2) How to make the Name and email box appear on the same line and website box + submit button full width?

Thanks!

Hi there,

1. Give this PHP a try:

add_action( 'generate_below_comments_title','generate_comments_email_message' );
function generate_comments_email_message()
{
    ?>
    <p class="comments-email-message">Your email address will not be published. Required fields are marked with *.</p>
    <?php
}

Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

2. This CSS should do it:

@media (min-width: 769px) {
    .comment-form #author, 
    .comment-form #email {
        width: 48%;
        float: left;
    }

    .comment-form #email {
        float: right;
    }

    .comment-form #url {
        width: 100%;
    }
}

Adding CSS: https://generatepress.com/knowledgebase/adding-css/

Hope this helps :)

I tried adding the Simple PHP plugin to add the PHP code. Now my website is down giving a http 500 server error.

How to fix this?

Nevermind. Deleted the plugin through FTP and the site is back.

The code itself works - tested it on my test server.

Make sure you don't remove anything from the file, it should start with <?php and the code should be at the bottom.

This is what I entered in the Simple PHP plugin.

add_action( 'generate_below_comments_title','generate_comments_email_message' );
function generate_comments_email_message()
{
    ?>
    <p class=&quot;comments-email-message&quot;>Your email address will not be published. Required fields are marked with *.</p>
    <?php
}

Hmm, did you copy the code I wrote from the notification email or from the actual post above?

My bad! copied the code from the notification email.

However, reinstalled the plugin and added the code from your reply above. Still not working.

The CSS worked perfectly (Thanks!)

What about it isn't working? Error on save, or not showing up? I have it plugged into my localhost and it's working perfectly.

I am able to save the code but the message is not showing in the comments area. Also in the plugin editor, I see this above the code editing area:

Editing generate-simple-php/custom.php (inactive)

I have activated the plugin and I can see the Appearance >> Simple PHP option.

What version of GeneratePress are you using? The hook has been there for a while.

Might be worth trying one of the other options on the Adding PHP page other than Simple PHP.

GP 1.3.39
GP Premium - 1.2.89

Not sure why the function won't work for you then.

Have you tried a plugin like Code Snippets?

This archived topic is closed to new replies.