Support » Plugin: Ninja Forms Contact Form - The Drag and Drop Form Builder for WordPress » OPEN CONTACT FORM MODAL FROM NAV MENU?

  • Resolved Amour Web Design

    (@safersheffield)


    Hi,

    Id like to open a Ninja form modal when my visitors click on the ‘Contact US’ link on our main nav menu.

    Can anyone help please?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Do you work with Bootstrap? What you might want to do is make a hidden modal in your templates HTML/PHP with a ninja-form php shortcode in it.

    <?php do_shortcode="[ninja_form id=x]"; ?>

    You only need to add some attributes to your contact us menu link via this hook in the case of the Bootstrap modal. In the case you create your own modal you can make your own javascript function based on the menu item class of that item.

    add_filter( 'nav_menu_link_attributes', 'wpse121123_contact_menu_atts', 10, 3 );
    function wpse121123_contact_menu_atts( $atts, $item, $args )
    {
      // The ID of the target menu item
      $menu_target = 123;
    
      // inspect $item
      if ($item->ID == $menu_target) {
        $atts['data-toggle'] = 'modal';
      }
      return $atts;
    }
    • This reply was modified 4 years, 9 months ago by Levdbas.
    Thread Starter Amour Web Design

    (@safersheffield)

    Thanks for the reply

    Im not very good at coding.

    I was just looking for a simple shortcode solution.

    I *think* there is no easy solution for this that does not require some custom coding in the form of some HTML/CSS/jQuery and some lines of PHP.

    @safersheffield please send me the details. I can help you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘OPEN CONTACT FORM MODAL FROM NAV MENU?’ is closed to new replies.