Wednesday, June 10, 2015

Valid Wordpress Comment Before Submit

For Wordpress Blog comment is most important for make complete Wordpress blog website and comment features.When you create any any wordpress website than comment is also include in default wordpress functionality.Wordpress also allow comment on any page and custom create post type.
If you want to remove comment functionality for page or post than edit that post and remove discussion check box in discussion meta box.If you want to remove comment functionality from any post type than remove 'comments' in `register_post_type`'s 'supports' parameters.
When you use Wordpress default comment functionality than  when any use click on submit button without enter name,email and comment than it's display blank screen and error display as below.

ERROR: please fill the required fields (name, email).

So if you want to change this steps and do not accept form without enter validation field than must validate comment form before submit using jQuery validation.
  1.  Download latest jQuery Validated file from http://jqueryvalidation.org/
  2. Call script file in header.php file of current theme directory as `
    <script src="<?php bloginfo('template_directory');?>/js/jquery.validate.js"></script>
    `
  3. Open comment.php file of theme (If not exits create new based on Wordpress default theme) and enter validation script for comment form as `jQuery("#commentForm").validate();`
Now without email,text and comment text not accept comment form and it's validated using jQuery validation.

2 comments :

  1. i will Provide Instant Wordpress Solutions.Optimize your site performance, create new widget, Responsive Design Issues, Cache Management, Logo,Slider Setup, Layout Changes, integrate Slider, integrate Carousel, E commerce Setup, Paypal setup, New wordpress installation, Moving wordpress from one domain to other, Simple pages setup, Create Image map, Social media setup, Google Analytic setup Horizontal/vertical Navigation, Custom Forms, Contact Forms, Setup Newsletter,

    All in One SEO Pack
    Akismet
    Contact Form 7
    LinkedIn
    Mailchimp
    Paypal
    Vimeo
    WooCommerce

    Please Discuss with me before Ordering Gig
    Thanks fiverr.com/king_of_kings

    ReplyDelete