Can’t Update function.php after writing short code
The answer by @motivast is correct. However, to avoid using a billion echo and apostrophes, you can simply close the PHP tag and open it after your script: function wpse_287665_mobile_menu_script() { ?> <script> jQuery(document).ready(function($){ $(“button.menu-toggle”).click(function(){ if( $(“button.menu-toggle”).attr(“aria-expanded”) == “true” ) { $(“button.menu-toggle”).attr(“aria-expanded”, “false”); $(“ul#top-menu”).attr(“style”, “display:none;”); } else { $(“button.menu-toggle”).attr(“aria-expanded”, “true”); $(“ul#top-menu”).attr(“style”,”display:block;”); } }); }); </script><?php … Read more