Modal in topbar

Support,

I have several modals throughout my site that work great. I’m trying to add an additional modal to my top bar, but am not having success. Right now I have a login button that redirects users to a login page. I’m trying to eliminate that page and hassle with a modal containing the login form. This is the code I’m using:

<a data-toggle=“modal” href="#Login” class=“wp-login-url”> Login

<!-- Modal content-->
<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">×</button>
    <h4 class="modal-title" >Login</h4>
  </div>
  <div class="modal-body">
	<div class="loginmodal">
      [wpv-login-form allow_remember="true"]
	  <a href="http://www.motorfieds.com/lost-password">Lost your password?</a><br>
	  New user? Please <a href="http://www.motorfieds.com/register">click here </a>to register. 
    </div>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  </div>
</div>

Is there a reason why this doesn’t work in the topbar, but works everywhere else on the site? Is additional coding needed in the functions.php file?

Thanks,
Chuck

My code isn’t fully showing above.

Here is my site: https://www.motorfieds.com/

In the topbar I have added an example of what’s happening, click “Report a Problem”

I added this code and was able to have the form shortcode work:

// Allow shortcodes in the topbar content
// =============================================================================
function allow_custom_shortcodes($contents) {
$contents = do_shortcode($contents);
return $contents;
}
add_filter(‘x_option_x_topbar_content’, ‘allow_custom_shortcodes’);
// =============================================================================

I think I need additional coding though.

Thanks,
Chuck

Hey Chuck,

We’re sorry but we could not provide support for custom code even you got it from our old forum. There’s a reason why shortcodes are not allowed in the Topbar and the code you used overrides that. Fixing issues arising from the use of it and further development are outside the scope of our support.

We understand that a lot of users want header flexibility and our answer is the Pro theme. You might want to upgrade to it.

Thanks.

All good. Got it to work.

Thanks,
Chuck

You’re welcome! :slight_smile: