Wordpress Snippets

Launch Bootstrap 4 Modal From WordPress Menu

Add .launch-contact-modal class to your WordPress menu item. This can be done from the admin interface Appearance > Menu.

Change #contactModal in the following jQuery to the ID of your Bootstrap 4 modal.

jQuery(document).ready(function($){
  // Adding Bootstrap Modal to WordPress Menu
  $('.launch-contact-modal').find('a').attr('data-toggle', 'modal');
  $('.launch-contact-modal').find('a').attr('data-target', '#contactModal');
});

Hire Us. Or just say Hi!
Need a job? Apply to get one.