Skip to content

Instantly share code, notes, and snippets.

@NickDeckerDevs
Last active July 27, 2018 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickDeckerDevs/913a7b07bae91e969a801d3f7250988c to your computer and use it in GitHub Desktop.
Save NickDeckerDevs/913a7b07bae91e969a801d3f7250988c to your computer and use it in GitHub Desktop.
Example menu template file for WordPress
<!-- please note this gist keeps reverting to 8 tabs and is really wasting my life, sorry for the screwed up tabbing -->
<?php
/**
* The template for displaying all pages
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
// you can replace the above text with your themes text.
// In the below example we are exporting out just the menu. If you are exporting out the whole header.php file
// that will export out the entire wp_head contents and all that nonsense. You really want to avoid that as you will
// have an insane amount of items being brought over.
wp_nav_menu(
array(
'menu' => 'Primary Navigation', // you may need to change this to the name of your navigation
'items_wrap' => '<nav id="main-nav" role="navigation" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement"><ul id="%1$s" class="%2$s">%3$s</ul>'
)
); // I'd also add I'm not sure you need role="navigation" if you are declaring <nav -- but whatever
// if you wanted to build the content for the space between your <header></header> tags in this file, that
// could work and you could bring then include_once into your header.php file, this file. This may make perfect
// sense to me, so if you have questions, please reach out!
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment