AI Assistant
Notifications
Clear all

default field added with content already added

10 Posts
3 Users
0 Reactions
2,711 Views
(@nikhilgkurup)
Active Member
Joined: 8 years ago
Posts: 14
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#2688]

hi ,

i would like to add a default field to add to every comment which should not be shown in comment form but added to comment when it is displayed on the website

like a disclaimer message "the comment added here is  by the author and my website doesnt have any take on this .. such and such etc" i want this message to be added after every comment by default . is it possible ?any workaround for this?



   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6645
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi nikhilgkurup,

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

add_filter('comment_text', 'add_custom_content');
function add_custom_content($comment_text) {
if ($comment_text) {
$comment_text .= "<div>the comment added here is by the author and my website doesn't have any take on this .. such and such etc</div>";
}
return $comment_text;
}

 



   
ReplyQuote
(@nikhilgkurup)
Active Member
Joined: 8 years ago
Posts: 14
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

hi thankyou for that  ......

but now the default comment is added with the actual comment .but i would like it to be after every fields . i have attached an image to make it more clear . i would like it to show after the time of journey field and before the like button and all .. is it not possible .?

comemntwpdiscuz


   
ReplyQuote
(@nikhilgkurup)
Active Member
Joined: 8 years ago
Posts: 14
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

hi is it not possible???



   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 11 years ago
Posts: 4245
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi @nikhilgkurup,

Probably you should use wpdiscuz_after_comment_text hook. Please remove the old code and try this one:

add_filter('wpdiscuz_after_comment_text', 'wpdiscuz_add_custom_content');
function wpdiscuz_add_custom_content( $comment_text, $comment ) {
        if ($comment_text) {
                $comment_text .= "<div class='wpd-custom-text'>the comment added here is by the author and my website doesn't have any take on this .. such and such etc</div>";
        }
        return $comment_text;
}


   
ReplyQuote
(@nikhilgkurup)
Active Member
Joined: 8 years ago
Posts: 14
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

hi the new code returned the following error

syntax error, unexpected 'wpd' (T_STRING)



   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 11 years ago
Posts: 4245
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

I just updated the code above, please change it.



   
ReplyQuote
(@nikhilgkurup)
Active Member
Joined: 8 years ago
Posts: 14
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

thank you very much it works now . .. is it possible to have any adjustment with the font size of this text  . now the disclaimer message is highlighted more than  the comment texts . i would like the default disclaimer be of small font size than the others or at least of the same size of added field entries . like the one i have encircled in the photo attached .in the pic the field entry 'ernakulam' is less in size than the default message added .

wpdicuz comment default


   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 11 years ago
Posts: 4245
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

I'm sorry but I don't have other solution. You should find some CSS socialist to do a custom styling for this case.



   
ReplyQuote
(@nikhilgkurup)
Active Member
Joined: 8 years ago
Posts: 14
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

oh its okay .thank you very much . 



   
ReplyQuote
Share:
Scroll to top