I am sorry for this nooby question, but I just don't get it :
I was working with the function reference for wp_nav_menu and this is my line of code:
<?php wp_nav_menu( array('theme_location' => 'header-menu','items_wrap' => '%3$s') ); ?>
But the menu is displayed in <ul><li>
anyway. (I want to remove that and make the menu horizontal).
I can put anything in the items_wrap
, it will always be the default <ul>
The theme_location is maybe not working too, but since I have only one menu yet, it displays the right one.
I want to say sorry again if this is very stupid, which I guess it is, but I ask for your patience and help, just a beginner here.
Full index.php:
<?php get_header(); ?>
<?php if(isset($_GET['nav'])) {
$nav = $_GET['nav']; } ?>
<body>
<div id="topbar">
<div id="orangebar"></div>
<div id="top-middle">
<a href="<?php echo home_url(); ?>"><img id="logo" src="<?php bloginfo('template_directory'); ?>/img/logo.png" /></a>
<div id="menu">
<?php
remove_all_actions( 'wp_nav_menu_args' );
remove_all_actions( 'wp_nav_menu' );
echo "\n\n<!-- start menu -->\n";
wp_nav_menu( array( 'theme_location' => 'header-menu', 'items_wrap' => 'j' ) );
echo "\n<!-- end menu -->\n\n";
?>
</div>
</div>
</div>
<div id="center">
<div id="centershade"><img id="shade" src="<?php bloginfo('template_directory'); ?>/img/shade.png" /></div>
<div id="main">
<a href="facebook link" target="_blank"><img id="fbbutton" src=" <?php bloginfo('template_directory'); ?>/img/buttons/fb.gif" /></a>
<a href="twitter link" target="_blank"><img id="twitbutton" src="<?php bloginfo('template_directory'); ?>/img/buttons/twitter.gif" /></a>
<div id="main-content">
<?php if (!( isset($nav) ) ) { include('startpage.php');} else { include($nav+'.php');} ?>
</div>
</div>
</div>
<?php get_footer(); ?>
functions.php:
<?php add_action( 'init', 'register_my_menu' );
function register_my_menu() {
register_nav_menu( 'header-menu', __( 'Header Menu' ) );
}
?>
Ok, please try to get over unstandardized naming and strange ways of achieving stuff, this is one-third learning, one-third testing and one-third development..
<ul></ul>
tags are removed. The list items are still wrapped in<li></li>
tags. The documentation does not indicate that theitems_wrap
argument will remove the<li></li>
tags. Your conclusion that thetheme_location
argument "maybe not working too" is only a guess until you actually test your conclusion.echo '<!-- menu started -->';
before andecho '<!-- menu ended -->';
after, then check the browser page source to see if the<ul></ul>
tags are inside those comments or outside them.