Hey Guys,
Haven't been able to find help so far so I thought I'd give this forum a try.
So basically I'm trying to center the submenus this plugin creates for wordpress.
The plugin is: "WP Menu Creator" http://wordpress.org/extend/plugins/wp-menu-creator/
Here is a Snippet the PHP Generates:
<li id="menu_item_5" class="mc_menu_item external_link ">
<a class="change_section panel submenu" rel="" title="5" href="http://localhost/">Main Menu Title</a>
<ul id="mc_submenu_5" class="mc_menu mc_depth_1">
<li id="menu_item_18" class="mc_menu_item external_link ">
<a class="change_section panel " rel="" title="5" href="http://localhost/">Submenu Title 1</a>
</li>
<li id="menu_item_20" class="mc_menu_item external_link ">
<a class="change_section panel " rel="" title="5" href="http://localhost/">Submenu Title 3</a>
</li>
<li id="menu_item_21" class="mc_menu_item external_link ">
<a class="change_section panel " rel="" title="5" href="http://localhost/">Submenu Title 4</a>
</li>
</ul>
</li>
And Here is the code that 'writes' this up:
function displayMenuFromItems($items, $depth, $parent, $ismenu) {
if ($items) :
echo "\n".'<ul id="' . ($ismenu ? "menu" : "mc_submenu_" . $parent) . '" class="mc_menu mc_depth_' . $depth . '">'."\n";
foreach ($items as $item) :
$class="";
if ($item["type"] == "wordpress") {
if (is_page($item["value"])) {
$class="current_page_item";
}
} else {
if (curPageURL() == $item["value"] || curPageURL() == $item["value"] . "/") {
$class="current_page_item";
}
}
$pos = strpos(pageURL(),'#');
/*if(isset($_GET['cat']) || isset($_GET['p']) || isset($_GET['m']) || isset($_GET['author']) || $pos != false) {
$urlAddon = 'index.php';
} else {
$urlAddon = '';
}*/
if(!isset($_GET['cat']) && !isset($_GET['p']) && !isset($_GET['m']) && !isset($_GET['author']) && ($pos != false || pageURL() == get_bloginfo('url').'/') || pageURL() == get_bloginfo('url')) {
$findHash = strpos($item['value'], '#');
if ($findHash != false) {
$item['value'] = substr($item['value'], $findHash);
}
}
echo '<li id="menu_item_' . $item["id"] . '" class="mc_menu_item ' . ($item["type"] == "wordpress" ? "wordpress_link" : "external_link") . ' ' . $class . '"><a href="' . $urlAddon. resolveURL($item) . '" title="' . ($ismenu ? $item["id"] : $parent) . '" rel="' . $item["target"] . '" class="change_section panel '. (count($item["subitems"]) > 0 ? 'submenu' : '') .'">' . $item["title"] . '</a>';
if ($depth>0) displayMenuFromItems($item["subitems"], $depth-1, $item["id"], false);
echo '</li>'."\n";
endforeach;
echo '</ul>'."\n";
endif;
I've tried placing <div>'s in between various to try and wrap/single out the submenu(to style it centered) but as you can see the <div>'s end up eventually wrapping the main menu.
I'm all out of ideas on workarounds without advanced PHP knowledge, so if there is anyone out there that can help me or point me into the right direction it will be much appreciated!
The site I'm working on is: http://jpatrolla.com/x (test site)
and you will be able to see which submenu's I'm trying to center under 'Blog' and 'Portfolio'
Thanks in Advance.
-Joe