ar-ras
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Plugin: WordPress Menu Creator] Home Menu ItemI solved it like this:
set type = wordpress and value to 0
function resolveURL($item) { if ($item["type"] == "wordpress" && $item["value"] == 0) return get_bloginfo( "url" ); if ($item["type"] == "wordpress") { $id = $item["value"]; // Updated May 14th $perma = get_permalink($id); if(strpos($_SERVER["REQUEST_URI"], "wp-admin")){ $url = explode("/",$perma, 4); if(count($url)>2) return $url[3]; } return $perma; // End Updated May 14th } else { return $item["value"]; } }function displayMenuFromItems($items, $depth, $parent, $ismenu) { global $post; if ($items) : echo "\n".'<ul id="' . ($ismenu ? "mc_menu_".$parent : "mc_submenu_" . $parent) . '" class="mc_menu mc_depth_' . $depth . '">'."\n"; foreach ($items as $item) : $class=""; if ($item["type"] == "wordpress") { if (is_page($item["value"]) || $item["value"] == $post->ID || ($item["value"] == 0 && is_home())) { $class="current"; } } else { if (curPageURL() == $item["value"] || curPageURL() == $item["value"] . "/") { $class="current"; } } echo '<li id="menu_item_' . $item["id"] . '" class="mc_menu_item ' . ($item["type"] == "wordpress" ? "wordpress_link" : "external_link") . ' ' . $class . '"><a href="' . resolveURL($item) . '" title="' . $item["alttext"] . '" rel="' . $item["target"] . '" >' . $item["title"] . '</a>'; if ($depth>0) displayMenuFromItems($item["subitems"], $depth-1, $item["id"], false); echo '</li>'."\n"; endforeach; echo '</ul>'."\n"; endif; }Hope this helps
Viewing 1 replies (of 1 total)