Today I’ve come across an interesting question on the WordPress.org support forum: How do I add a toggling search box to the WordPress.org MH Magazine Lite theme?

Here’s a video that shows you how to accomplish this (download .zip file available).

Download .zip File
You can freely download and use the demo files for this tutorial.

If you intend to distribute your theme, all strings of text should be translation-ready. Therefore, a better approach to the screenreader text in header.php presented in the video is the following:

_e( ‘Click here to display searchbox’, ‘mh-magazine-lite-child’ )
_e( ‘Click here to hide searchbox’, ‘mh-magazine-lite-child’ )

The download files have been updated accordingly.

Resources
MH Magazine Lite WordPress.org Theme
Genericons Icon Fonts
wp_enqueue_style
wp_enqueue_script
wp_enqueue_scripts
load_child_theme_textdomain
get_search_form
Was this tutorial useful? Let me know

Leave a comment

Your email address will not be published.