Adding Custom Shortcode Widget To Main Navigation
-
Trying to place a custom shortcode widget to the main navigation area of our website for mobile users only.
This shortcode widget has a live search feature for the website.
Using the code below adds this, but it also adds it to the desktop devices as well.
add_action( ‘generate_inside_navigation’,’tu_add_to_mobile_bar’ );
function tu_add_to_mobile_bar() {
?>
<div class=”search”>
<?php echo do_shortcode(“search widget shortcode”]’ ); ?>
</div>
<?php
}How could the above code be adapted so that this only shows on mobile devices, without the need for hiding this on desktop devices with some CSS?
Also, we have disabled the built in navigation search in the primary navigation of this theme, which then moves the mobile menu to the middle of the screen on mobile devices.
The CSS below moves the menu button to the left on mobile devices:
button.menu-toggle {
text-align:left;
}
Trying to work out the best way to align our custom search widget to the right of the menu, so that it sits neatly across mobile devices?
Kind Regards,
Andrew
The topic ‘Adding Custom Shortcode Widget To Main Navigation’ is closed to new replies.
