Navigation bar/Theme development
-
Hi everyone!
I hope this is the right place for this kind of questions. In case it is not, I apologize in advance.
Anyway, I am developing my own wordpress theme from scratch and I am having troubles with the navigation bar. I already registered the navigation menu into the ‘functions.php’ file and then called the ‘wp_nav_menu()’ into the ‘header.php’ file. Everything works well but, I would like to add a logo link into this navigation bar. So what’s the best way to do that?
I was writing a function into ‘functions.php’:function initialize_nav_bar() { echo "<script type='text/javascript'>"; echo "document.getElementsByClassName('menu-top-menu-container');"; echo "navbar = document.getElementsByClassName('menu-top-menu-container');"; echo "logo = document.createElement('a');"; echo "logo.setAttribute('id', 'logo');"; $homepath = "<?php bloginfo('template_directory'); ?>/index.php"; echo "logo.setAttribute('href', '$homepath');"; echo "</script>"; }I’m not sure this is the right way to do that. Do you have any suggestions?
Thank you so much!
The topic ‘Navigation bar/Theme development’ is closed to new replies.