All Projects → GaryJones → Genesis Header Nav

GaryJones / Genesis Header Nav

Licence: gpl-2.0
WordPress plugin that registers a menu location and displays it inside the header for a Genesis Framework child theme.

Projects that are alternatives of or similar to Genesis Header Nav

React Cube Navigation
3d cube style navigation pattern, like that found in Instagram Stories
Stars: ✭ 59 (-11.94%)
Mutual labels:  navigation
Ng2 Breadcrumbs
A breadcrumb service for the Angular 7 router
Stars: ✭ 61 (-8.96%)
Mutual labels:  navigation
Wordpress Base Plugin
A starter template for WordPress plugins, with autoloading, namespaces and object caching (where available).
Stars: ✭ 65 (-2.99%)
Mutual labels:  wordpress-plugin
Mogu
一个简约的php书签网址导航
Stars: ✭ 60 (-10.45%)
Mutual labels:  navigation
Jumpmarks
Xcode plugin for numbered bookmarks
Stars: ✭ 60 (-10.45%)
Mutual labels:  navigation
E Commerce App React Native
E-commerce App UI. React native, Expo managed flow, React navigation v5, Notification.
Stars: ✭ 61 (-8.96%)
Mutual labels:  navigation
Wp Rest Api Log
WordPress plugin for logging REST API requests and responses
Stars: ✭ 58 (-13.43%)
Mutual labels:  wordpress-plugin
Compass
A Minimal Compass iOS App 🧭
Stars: ✭ 67 (+0%)
Mutual labels:  navigation
React Native Learning Resources
Collection of some good resources for react-native ✨ 🔥 💥
Stars: ✭ 61 (-8.96%)
Mutual labels:  navigation
Wordpress Indieweb
Helps you establish your IndieWeb identity by extending the user profile to provide rel-me and h-card fields. It also includes a bundled installer for a core set of IndieWeb-related plugins.
Stars: ✭ 64 (-4.48%)
Mutual labels:  wordpress-plugin
Jetpackmvvm
🐔🏀一个Jetpack结合MVVM的快速开发框架,基于MVVM模式集成谷歌官方推荐的JetPack组件库:LiveData、ViewModel、Lifecycle、Navigation组件 使用Kotlin语言,添加大量拓展函数,简化代码 加入Retrofit网络请求,协程,帮你简化各种操作,让你快速开发项目
Stars: ✭ 1,100 (+1541.79%)
Mutual labels:  navigation
Theme My Login
Home of the Theme My Login plugin for WordPress.
Stars: ✭ 60 (-10.45%)
Mutual labels:  wordpress-plugin
Androidpreferenceactivity
Provides an alternative implementation of Android's PreferenceActivity
Stars: ✭ 63 (-5.97%)
Mutual labels:  navigation
Airr React
Animated views navigation and more for your Desktop and Mobile ReactJS app
Stars: ✭ 59 (-11.94%)
Mutual labels:  navigation
Grid map
Universal grid map library for mobile robotic mapping
Stars: ✭ 1,135 (+1594.03%)
Mutual labels:  navigation
Qqheader
一个高仿QQ讨论组头像的实现
Stars: ✭ 58 (-13.43%)
Mutual labels:  header
Re Navigate
Example of React Native Navigation with re-frame/re-natal
Stars: ✭ 61 (-8.96%)
Mutual labels:  navigation
Wp Gistpen
A self-hosted alternative to putting your code snippets on Gist.
Stars: ✭ 67 (+0%)
Mutual labels:  wordpress-plugin
Plasma
An Android Application written using latest Android Jetpack components and best practices, which displays trending movies/TV shows and cast, user can search movies and TV shows and also add them to watchlist.
Stars: ✭ 67 (+0%)
Mutual labels:  navigation
Wordpress Progressive Web Apps
WordPress Mobile Plugin including a Progressive Web App implemented with React
Stars: ✭ 64 (-4.48%)
Mutual labels:  wordpress-plugin

Genesis Header Nav

WordPress plugin that registers a menu location and displays it inside the header for a Genesis Framework child theme.

Description

The default method of getting a menu to appear in the top right of a site using a child theme of the Genesis Framework, is to add a create a menu in Appearance -> Menus, and then place a Custom Menu widget in the Header Right widget area. While this works, it produces markup as seen in screenshot 1, and which has the following problems:

  • Since the menu is output from a widget, you end up with all of the extraneous widget and widget area markup - in a child theme with HTML5 support, that's the widget area aside, the widget section, and the widget wrap div. In themes without HTML5 support, it's three levels of div elements instead. Not only is this more DOM elements to render (performance), but all markup in the site header is pushing the real page content further down the source; search engines apparently put higher value on content at the top of the source (which is why Genesis ensures primary and secondary sidebars come lower in the source than the main content, irrespective of where they are displayed on screen).

  • In HTML5 themes, what could be a site's main navigation is wrapped in an aside element. It's not known whether this has any impact on SEO. Theoretically at least, search engines may put less value on navigation found in an aside or otherwise treat it differently.

    "I can't think of any good reason to use an aside in a header... what the hell would it be contextually related to? The logo? lol" - Robert Neu

This plugin registers a new menu location called Header and, if a menu is assigned to it, displays it after the Header Right area. If you don't have any widgets in the Header Right area, then Genesis ensures that none of that widget area markup is output, so you end up with code like screenshot 2. If you do want a widget in the Header Right area, that's fine - it can be positioned and styled as you want, without negatively affecting the navigation menu as well.

Screenshots

Screenshot of markup using Custom Menu widget
Screenshot 1: Markup using Custom Menu widget. Note the aside, section and div parents to nav.


Screenshot of markup using this plugin
Screenshot 2: Markup using this plugin. nav is a sibling element to the title area div.

Requirements

  • PHP 5.3+
  • WordPress 3.9+
  • Genesis 2.1+

Installation

Upload

  1. Download the latest tagged archive (choose the "zip" option).
  2. Go to the Plugins -> Add New screen and click the Upload tab.
  3. Upload the zipped archive directly.
  4. Go to the Plugins screen and click Activate.

Manual

  1. Download the latest tagged archive (choose the "zip" option).
  2. Unzip the archive.
  3. Copy the folder to your /wp-content/plugins/ directory.
  4. Go to the Plugins screen and click Activate.

Check out the Codex for more information about installing plugins manually.

Git

Using git, browse to your /wp-content/plugins/ directory and clone this repository:

git clone [email protected]:GaryJones/genesis-header-nav.git

Then go to your Plugins screen and click Activate.

Updates

This plugin supports the GitHub Updater plugin, so if you install that, this plugin becomes automatically updateable direct from GitHub.

Change Log

See the CHANGELOG.md.

Usage

Once activated, head to Appearance -> Menus. Create a menu as usual, and assign it to the Header menu location.

Backwards-incompatible Changes

The hook that filters the menu was called genesis_do_header_nav but is now called genesis_header_nav due to using the genesis_header_nav() function in Genesis 2.1.

2.0.0: Custom language files previously loaded from (example) WP_LANG_DIR . '/genesis-header-nav/genesis-header-nav-en_GB.po' now need to be placed at WP_LANG_DIR . '/plugins/genesis-header-nav-en_GB.po', as per language packs.

2.0.0: This plugin uses PHP namespaces, so you'll need PHP 5.3+ powering your site.

Customising

CSS

The plugin should work with all Genesis child themes, though you may need to add styles to position the output in the traditional place of top right, e.g.:

.nav-header {
	float: right;
	text-align: right;
	width: 50%;
}

Adjust the width as needed to allow enough space for your title area and menu items.

Priority

The plugin includes a genesis_header_nav_priority filter, with a default value of 12. Use the following values to reposition the nav accordingly:

  • Before the <header> element, inside the .site-container: 0-4
  • Before the title + widget area: 5-9
  • After the title + widget area: 10-14
  • After the <header> element: 15+

If you want to add it in between the title and widget area, you'll need to unhook and re-build genesis_do_header() function so that the output of the widget area is in a different function that can be hooked to a later priority.

As an example, to add the nav before the title + widget area markup in the source, you can use the following:

add_filter( 'genesis_header_nav_priority', 'prefix_genesis_header_nav_priority' );
/**
 * Change the order of the nav within the header (Genesis Header Nav plugin).
 *
 * @param int $priority Existing priority. Default is 12.
 *
 * @return int New priority.
 */
function prefix_genesis_header_nav_priority( $priority ) {
	return 8;
}

Top Menu (above <header>)

If you give the above priority filter a value of less than 5, then the output will be before the <header>, so that you can display what might be considered a Top menu. Of course, this might mean that the "Header" menu location label is confusing, but since that string is internationalised, it's possible to filter that and change it to make it easier for users to understand:

add_filter( 'gettext', 'prefix_genesis_header_nav_name', 10, 3 );
/**
 * Change the name of the Header menu location added by Genesis Header Nav plugin.
 * 
 * @param string $translated_text Translated text.
 * @param string $original_text   Original text.
 * @param string $domain          Text domain.
 */
function prefix_genesis_header_nav_name( $translated_text, $original_text, $domain ) {
	if ( 'genesis-header-nav' === $domain && 'Header' === $original_text ) {
		return 'Top';
	}
	return $translated_text;
}

Removing the Menu

If you want the menu to not display, perhaps on a landing page, then you can do the following:

add_action( 'init', 'prefix_genesis_header_nav_remove', 11 );
/**
 * Remove Genesis Header Nav menu.
 */
function prefix_genesis_header_nav_remove() {
	if ( function_exists( 'Gamajo\GenesisHeaderNav\get_plugin' ) ) {
		remove_action( 'genesis_header', array( Gamajo\GenesisHeaderNav\get_plugin(), 'show_menu' ), apply_filters( 'genesis_header_nav_priority', 12 ) );
	}
}

Credits

Built by Gary Jones
Copyright 2013 Gamajo Tech

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].