I am trying to add this in an abc.php file where add_footer_menu() is a onclick function. This is showing me the “Menu added.” but menu is actually not generating.
<script type="text/javascript">
function add_footer_menu(){
<?php
add_action( 'after_setup_theme', 'register_my_footer_menu' );
function register_my_footer_menu() {
register_nav_menu( 'abc', 'abc menu');
}
?>
document.getElementById("notify_menu").innerHTML = "Menu added. Go to Themes > Menus to add menu items.";
}
</script>
The topic ‘Register a menu onclick function’ is closed to new replies.