wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

[Solved] How do add the header or hide the form


larshallen
Posts: 3
Topic starter
(@larshallen)
New Member
Joined: 2 years ago

Is it possible to add a header (title) for the comment-section and/or hide the commenting form and show comments first hand with a "leave a reply..."-button that will show the form?

12 Replies
Tom
Posts: 447
 Tom
Support
(@tomson)
Support Team
Joined: 6 years ago

Hi @larshallen,

You can add any header, text or HTML code before the comment form using this action hook:

https://wpdiscuz.com/docs/codex/actions/wpdiscuz_comment_form_before/

Using WordPress action hooks: https://www.google.com/search?q=how+to+use+action+hooks+in+wordpress

1 Reply
larshallen
(@larshallen)
Joined: 2 years ago

New Member
Posts: 3

Thanks @tomson for your swift reply

I haven’t discovered action hook yet, I guess now was the time. This is moving my use of Wordpress to a new level. Can I ask you, is it with action hooks that I move the comment form to the end of the comments area instead of where it is by default, which is the beginning? Another way of putting this question:

Is there a simple and straightforward way to move the form to the end instead of the beginning, where it is now? And if there is such a way I would love to have a written walkthrough by someone whom have done that before me. It seems it could be a thing that someone have tried to do before me.

Thank you

Lars

 

Tom
Posts: 447
 Tom
Support
(@tomson)
Support Team
Joined: 6 years ago
Posted by: @larshallen

Is there a simple and straightforward way to move the form to the end instead of the beginning, where it is now? And if there is such a way I would love to have a written walkthrough by someone whom have done that before me. It seems it could be a thing that someone have tried to do before me.

I'm really sorry but this is impossible. wpDiscuz has no chance to work with a comment form located at the bottom.

Kompozitor
Posts: 2
(@kompozitor)
New Member
Joined: 2 years ago

Hi, I am interested in displaying a Title as well.

I don't understand how this "hook" thing works, it's too technical.

Could the Wpdiscuz team provide an example ?

Thanks a lot

3 Replies
Zackar
Support
(@zackar)
Joined: 6 years ago

Support Team
Posts: 8

Hi @kompozitor.

You can use this code.

add_action('wpdiscuz_comment_form_before', function() {

?>

<h3>Your Custom Title!</h3>

<?php

});
inchenaim
(@inchenaim)
Joined: 2 years ago

Active Member
Posts: 14

@zackar

Hello, this snippet should i put in theme's function.php?

Zackar
Support
(@zackar)
Joined: 6 years ago

Support Team
Posts: 8
Kompozitor
Posts: 2
(@kompozitor)
New Member
Joined: 2 years ago

Works perfectly ! thanks !

AeroStar
Posts: 84
(@aerostar)
Trusted Member
Joined: 1 year ago

@zackar,

Thank you. Worked like a charm!

@community,

This is what we did:

(1) Installed the plugin, Code Snippets.

(2) Created the following snippet (snippet setting: front-end only):

add_action('wpdiscuz_comment_form_before', function() {
?>
<p style="margin-top16px;">ALL COMMENTS ARE REVIEWED PRIOR TO POSTING</p>
<?php
});

(3) Result: Click here.

Stan
Posts: 2
 Stan
(@stan)
New Member
Joined: 8 months ago

Hi there,

First off, I'm incredibly grateful for WpDiscuz! But I do miss the previous Comment Header. If I remember well, there was a small bubble with the number of comments right on the left of the actual Header and the whole thing just looked neat and pretty. Now it feels that something is missing, at least on my website. Would be amazing if you could bring it back in a future update.

Thanks a lot for the snippets. However, my website is bilingual and I need to have 2 different Comment Headers in English and Greek ( in the previous version of WpDiscuz all I had to do was to translate it in LocoTranslate). Does anyone have any idea how to insert a different snippet for each language?

Thanks a lot!

2 Replies
Asti
 Asti
Support
(@asti)
Joined: 4 years ago

Support member
Posts: 3860

@stan,

Please follow the steps below: 

1. Put the following code in the active theme functions.php file: 

add_action('wpdiscuz_comment_form_before', function() {
    echo '<h3>' . __('Your Custom Title!' , 'wpdiscuz') .'</h3>';
});

Change the red marked value as you like.

2. Install and activate the Loco Translate plugin (if you don't have it)

3. Go to Dashboard > Loco Translate > Plugins > wpDiscuz tab and click on the "Edit template" button

image

4. Add the custom phrase (e.g. "Your Custom Title!") and save the changes

image

5. Again go to Dashboard > Loco Translate > Plugins > wpDiscuz tab edit the language (Greek)

6. Click on the "Sync" (this step is important, don't miss it)

7. Find and translate the custom phrase (e.g. "Your Custom Title!")

Stan
 Stan
(@stan)
Joined: 8 months ago

New Member
Posts: 2

@asti, thank you very much for your very detailed set of instructions, it worked like a charm!

Share: