Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

child theme function override for navigation.php #88

Merged
merged 1 commit into from
Aug 18, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 59 additions & 52 deletions library/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,67 @@
* Left top bar
* http://codex.wordpress.org/Function_Reference/wp_nav_menu
*/
function foundationPress_top_bar_l() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container
'menu' => '', // menu name
'menu_class' => 'top-bar-menu left', // adding custom nav class
'theme_location' => 'top-bar-l', // where it's located in the theme
'before' => '', // before each link <a>
'after' => '', // after each link </a>
'link_before' => '', // before each link text
'link_after' => '', // after each link text
'depth' => 5, // limit the depth of the nav
'fallback_cb' => false, // fallback function (see below)
'walker' => new top_bar_walker()
));
if ( ! function_exists( 'foundationPress_top_bar_l' ) ) {
function foundationPress_top_bar_l() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container
'menu' => '', // menu name
'menu_class' => 'top-bar-menu left', // adding custom nav class
'theme_location' => 'top-bar-l', // where it's located in the theme
'before' => '', // before each link <a>
'after' => '', // after each link </a>
'link_before' => '', // before each link text
'link_after' => '', // after each link text
'depth' => 5, // limit the depth of the nav
'fallback_cb' => false, // fallback function (see below)
'walker' => new top_bar_walker()
));
}
}

/**
* Right top bar
*/
function foundationPress_top_bar_r() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container
'menu' => '', // menu name
'menu_class' => 'top-bar-menu right', // adding custom nav class
'theme_location' => 'top-bar-r', // where it's located in the theme
'before' => '', // before each link <a>
'after' => '', // after each link </a>
'link_before' => '', // before each link text
'link_after' => '', // after each link text
'depth' => 5, // limit the depth of the nav
'fallback_cb' => false, // fallback function (see below)
'walker' => new top_bar_walker()
));
if ( ! function_exists( 'foundationPress_top_bar_r' ) ) {
function foundationPress_top_bar_r() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container
'menu' => '', // menu name
'menu_class' => 'top-bar-menu right', // adding custom nav class
'theme_location' => 'top-bar-r', // where it's located in the theme
'before' => '', // before each link <a>
'after' => '', // after each link </a>
'link_before' => '', // before each link text
'link_after' => '', // after each link text
'depth' => 5, // limit the depth of the nav
'fallback_cb' => false, // fallback function (see below)
'walker' => new top_bar_walker()
));
}
}

/**
* Mobile off-canvas
*/
function foundationPress_mobile_off_canvas() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container
'menu' => '', // menu name
'menu_class' => 'off-canvas-list', // adding custom nav class
'theme_location' => 'mobile-off-canvas', // where it's located in the theme
'before' => '', // before each link <a>
'after' => '', // after each link </a>
'link_before' => '', // before each link text
'link_after' => '', // after each link text
'depth' => 5, // limit the depth of the nav
'fallback_cb' => false, // fallback function (see below)
'walker' => new top_bar_walker()
));
if ( ! function_exists( 'foundationPress_mobile_off_canvas' ) ) {
function foundationPress_mobile_off_canvas() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container
'menu' => '', // menu name
'menu_class' => 'off-canvas-list', // adding custom nav class
'theme_location' => 'mobile-off-canvas', // where it's located in the theme
'before' => '', // before each link <a>
'after' => '', // after each link </a>
'link_before' => '', // before each link text
'link_after' => '', // after each link text
'depth' => 5, // limit the depth of the nav
'fallback_cb' => false, // fallback function (see below)
'walker' => new top_bar_walker()
));
}
}

/**
Expand All @@ -79,13 +85,14 @@ function foundationPress_mobile_off_canvas() {
* 3) On your menu item, type 'has-form' in the CSS-classes field. Type 'button' in the XFN field
* 4) Save Menu. Your menu item will now appear as a button in your top-menu
*/

function add_menuclass($ulclass) {
$find = array('/<a rel="button"/', '/<a title=".*?" rel="button"/');
$replace = array('<a rel="button" class="button"', '<a rel="button" class="button"');

return preg_replace($find, $replace, $ulclass, 1);
if ( ! function_exists( 'add_menuclass') ) {
function add_menuclass($ulclass) {
$find = array('/<a rel="button"/', '/<a title=".*?" rel="button"/');
$replace = array('<a rel="button" class="button"', '<a rel="button" class="button"');

return preg_replace($find, $replace, $ulclass, 1);
}
add_filter('wp_nav_menu','add_menuclass');
}
add_filter('wp_nav_menu','add_menuclass');

?>