WordPress

Server Side Validation For Ninja Forms

2017-09-22T12:15:10+00:00 By |WordPress|

We recently had a client who were using Ninja Forms on their site and wanted to use it's registration module for letting users register on the website. Ninja Forms is a pretty neat plugin and it was super easy to quickly create the registration form with it. The client also needed a validation by which [...]

How to get total comments count for a post?

2017-08-17T06:58:17+00:00 By |WordPress|

Wordpress provide with the following function: <?php wp_count_comments( ); ?> The above code gets the total count of all comments present on the site. If we need to get the total comments count of a particular post then we can use following code: <?php $comments_count = wp_count_comments( $post_ID ); echo "Comments in [...]

How to override JavaScript files in child theme?

2017-07-27T05:57:19+00:00 By |WordPress|

Sometimes we might need to modify or add some extra javascript in your parent themes main JS file. But if you make changes directly in the parent theme JS file the changes would be lost when you update the theme. So you can do this by creating a child theme or a custom plugin and [...]

How to Create WordPress Widget?

2017-08-14T13:17:08+00:00 By |WordPress|

We're going to create a simple sidebar widget like the default "Text" widget, which will have a title and description. It will contain only two fields - title and description, but in your widget you can add as many as you want. How it'll work is, if we fill data under these fields from widgets [...]

How to get post content and author ID of post outside loop?

2017-07-13T11:11:14+00:00 By |WordPress|

Sometimes you might need the post content or author ID of a post outside the loop. You can use get_the_content() and get_the_author() functions by passing the post ID, but it  won't work every time. You can get it by using the following line: <?php get_post_field( $field, $post_id ); ?>; Both $field and $post_id parameters are required. The $field [...]