How to assign a class “active” to the li click event using jQuery or JavaScript

I am trying to create a menu where a class “active” is assigned to the page whenever it’s selected and loaded and following this using javascript my menu its custom <ul class=”nav navbar-nav”> <li class=”active”><a href=”http://localhost/wp/index.php”>Main</a></li> <li><a href=”http://localhost/wp/news”>News</a></li> <li><a href=”http://localhost/wp/contacts”>Contacts</a></li> </ul> Its working at my end use this <script> jQuery(document).ready(function() { jQuery(“.nav.navbar-nav li”).click(function(){ jQuery(“.nav.navbar-nav li”).removeClass(‘active’); … Read more

How to Create Custom Post Types in WordPress

Custom post types are one of the more useful features in WordPress. In this article, we will show you how to create custom post types in WordPress. Creating custom post type the Easy way you can create manually  custom post type by adding the required code in your theme’s functions.php file // Our custom post type function function create_posttype() { … Read more

How to use Ajax in wordpress

Ajax is fast and Smooth Way of Display content Result in Ajax is now used in many various ways on a website, such as submitting blog comments, liking posts and uploading files. Given the popularity of Ajax, most of the leading CMS platforms use it within their architecture. WordPress is no different. Actually WordPress employs … Read more

Submit a Custom Post Type in WordPress from the Front End

To allow users to submit content, you need to provide a form. The form fields will be used to input details, such as title, post content, tags, categories, featured image, etc. For example, you could create the form as follows: <form method=”post”><p><label for=”stackTitle”><?php _e(‘Enter the Post Title:’, ‘mytextdomain’) ?></label> <input type=”text” name=”stackTitle” id=”stackTitle” /></p> <p> … Read more