Template overriding
 
Notifications
Clear all

Template overriding

5 Posts
2 Users
0 Likes
1,372 Views
(@gianluca)
Member Customer
Joined: 4 years ago
Posts: 3
Topic starter  

Hi all,

I need to do some in changes in templates/comment/comment-form.php. I tried to override the file by creating a copy in my theme, into a folder named wpdiscuz/comment/, but it didn't work.

How can I override the template properly? I made my changes on the original file, just to do what I want to, but I don't want to lose my changes at the first plugin update. Can you help me?

Thanks in advance

 

Gianluca


   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5912
 

Hi @gianluca,

Please let us know the version you're using. If you use the wpDiscuz 5.3.5 version, you can customize the following two file:

  • /wpdiscuz/assets/css/wpdiscuz.css (Style / Colors / Backgrounds …)
  • /wpdiscuz/templates/comment/class.WpdiscuzWalker.php (Layout, HTML structure)

You'll be able to customize the comment-form.php file only in the wpDiscuz 7 version. More info here: https://beta.wpdiscuz.com/docs/wpdiscuz-7/customization/custom-template-and-style/

The wpDiscuz 7 beta you can check here: https://beta.wpdiscuz.com/demo/


   
ReplyQuote
(@gianluca)
Member Customer
Joined: 4 years ago
Posts: 3
Topic starter  

Hi @astghik, I'm using the 5.3.5 version.

I simply need to change the line 223, like this:
echo $wpdiscuz->helper->getCurrentUserDisplayName($currentUser);

Basically, I just need to remove the a tag in the user name, and the logout link too (and the pipe that separates these two elements). I can't do it via class.WpdiscuzWalker.php too, I guess...

 

Let me know

 

Thanks

 

 

Gianluca


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5912
 

@gianluca,

You can use this js code, just put it in the active theme js files:

jQuery('#wc_show_hide_loggedin_username').text(jQuery('#wc_show_hide_loggedin_username').text().replace(/(\s+\|+.*?)$/, ''));

   
ReplyQuote
(@gianluca)
Member Customer
Joined: 4 years ago
Posts: 3
Topic starter  

@astghik

Thanks for the trick. I just changed it a little bit:

$('#wc_show_hide_loggedin_username').text($('#wc_show_hide_loggedin_username a').first().text());

Not the nicest piece of code that I ever wrote, but it works!

Cheers from Italy

 

 

Gianluca


   
ReplyQuote
Share:
Scroll to top