Jump to content

Solved: Custom comments form


formmailer
 Share

Recommended Posts

Hi,

I am trying to style the comments form (and comments list) to match the rest of the site. I know that it's possible to edit the CSS file for the comments module, but I would rather add my existing classes to the fields, instead of making another css file containing the same CSS styling.

I use the following to render the form: $page->comments->renderForm();

Is there an easy way to add the CSS classed to the fields?

 

//Jasper

Edited by formmailer
Solved
Link to comment
Share on other sites

Take a look at this post (https://processwire.com/talk/topic/17263-custom-comments-form-and-list-styling/?do=findComment&comment=151627): You can copy the comment files from wire/modules into the module folder of your site folder (site/modules) and there you can change your CSS classes and the markup too.

I think this is the best approach to adapt the comments output to your needs. You dont need to hack anything and it will not be overwritten during updates.

 

  • Like 1
Link to comment
Share on other sites

Hi!

Yes, I thought about doing that, but I was hoping there was a shortcut to this. A risk (even if it's a minimal one) is that future core updates could break the module.

I was hoping there would be a way to change classes without modifying the module. But if this isn't possible I'll go with the copied & modified module.

//Jasper

Link to comment
Share on other sites

Another approach would be to add the CSS classes with Jquery onload, but you are also not aware of changes in the future. I use the first method for years now and I had no problems. I dont think that there will be major changes taken in the future.  

At the moment you could only change some attributes of the form tag, but not for the inputs.:(

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...