Jump to content

Foundation 4 menu turned Vertical (SOLVED)


Mont
 Share

Recommended Posts

I have been transitioning all my sites to https and noticed the first PW site I did, https://www.chicagoplumbingcode.com that uses the Foundation 4 drop in site profile is rendering the navigation menu vertically instead of horizontally.  I have tried a few things including adding a class " inline-list" but no luck.   Any thoughts?  Just upgraded wire to 3.0.42.

 

Code from _nav.php

/**
 * Render a <ul> navigation list 
 *
 */
function renderNav(PageArray $items, array $options = array()) {

	if(!count($items)) return '';

	$defaults = array(
		'fields' => array(), // array of other fields you want to display (title is assumed)
		'class' => 'inline-list', // class for the <ul>
		'active' => 'active', // class for active item
		'dividers' => false, // add an <li class='divider'> between each item?
		'tree' => false, // render tree to reach current $page?
		);

	$options = array_merge($defaults, $options); 
	$page = wire('page');
	$out = "<ul class='$options[class]'>";
	$divider = $options['dividers'] ? "<li class='divider'></li>" : "";

	foreach($items as $item) {

		// if this item is the current page, give it an 'active' class
		$class = $item->id == $page->id ? " class='$options[active]'" : "";

		// render linked item title
		$out .= "$divider<li$class><a href='$item->url'>$item->title</a> "; 

		// render optional extra fields wrapped in named spans
		if(count($options['fields'])) foreach($options['fields'] as $name) {
			$out .= "<span class='$name'>" . $item->get($name) . "</span> ";
		}

		// optionally render a tree recursively to current $page 
		if($options['tree']) {
			if($page->parents->has($item) || $item->id == $page->id) {
				$out .= renderNav($item->children("limit=50"), array(
					'fields' => $options['fields'],
					'tree' => true,
					)); 
			}
		}

		$out .= "</li>";
	}

	$out .= "</ul>";
	return $out; 	
}

 

Capture.PNG

Edited by Mont
Solved status
Link to comment
Share on other sites

1 hour ago, fbg13 said:

Seems to be caused by the divider, hiding them fixes the problem.

Thank you for your extra eyes.  This fix will have to do until I get Foundation 6 (no dividers in menu I hear).  Much appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...