• Resolved Brian

    (@bwold)


    Wondering if it’s possible to trigger the modal from a menu item. For example, menu item “Learn More” — when clicked, the modal pops up with more info.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter Brian

    (@bwold)

    Think I found the answer to my question. Sharing in case it helps others. You’re going to create a widget that will be hidden until the trigger item is clicked.

    1) Create a popup widget somewhere in your theme’s widget locations that’ll appear on all pages (in my case, a footer widget). Leave the widget title blank (If you enter a widget name, it’ll show on screen — alternatively, you could probably use a title and then set it to display: none in CSS.)

    2) In the Trigger tab of that widget, set the trigger to “Custom Element Click” and provide a unique CSS selector name (e.g. :.learn-more-modal). Remember this name; you’ll need it later. Save the widget, of course…

    3) Go to WP Admin > Appearance > Menus. Click the Screen Options tab at the upper right of the page, then check the box for CSS Classes. All of the menu items should now show an extra box for custom CSS class names.

    4) Add a new Custom Link menu item, or modify an existing one. Set the URL as “#” (or other anchor selector), the text to whatever you want people to see, and the CSS Class as the selector name from Step 2. Here, you do not use the initial period (e.g. “learn-more-modal” with no period in front). Save the menu.

    That should do it. The widget hides in wait on all pages that load that widget, and when someone clicks the menu item, the popup is revealed.

Viewing 1 replies (of 1 total)
  • The topic ‘Modal popup triggered from menu item?’ is closed to new replies.