2014-11-01, 01:38:29
Hello, i need to add custom menu that link to external websitets in a new windows.
I tried the I18N Navigation but its uses a redirect and its not good.
Are there other options available?
I'm looking for something supported by the admin menĂ¹ too.
So far i've hacked my theme's functions.php with the following code:
Maybe i just have to add the extra fields and write a comple plugin?
Or there is some already plugin made?
For each menĂ¹ i need:
- external URL
- target (usually _blank)
- rel (for "nofollow")
Thanks
I tried the I18N Navigation but its uses a redirect and its not good.
Are there other options available?
I'm looking for something supported by the admin menĂ¹ too.
So far i've hacked my theme's functions.php with the following code:
PHP Code:
add_filter( 'menuitems', 'my_menuitems' );
function my_menuitems($menuitems) {
// decode HTML
preg_match_all("/<li(.*?)>(.*?)<\/li>/",$menuitems,$menuarray);
// debug HTML
//echo '<pre style="color:#fff;background:#000">'.PHP_EOL; echo htmlspecialchars(print_r($menuarray[0],TRUE)); echo '<hr>'.PHP_EOL; die('eof');
foreach ($menuarray[0] as &$item) {
if (preg_match('/\/video\//',$item)) {
$item = '<li class="video"><a target="_blank" href="http://www.youtube.com/channel/UClrVRJwGL596mRm1ODcLcRg" title="Video">Video</a></li>';
}
}
// Recreate Menu string
return implode( '', $menuarray[0] );
}
Maybe i just have to add the extra fields and write a comple plugin?
Or there is some already plugin made?
For each menĂ¹ i need:
- external URL
- target (usually _blank)
- rel (for "nofollow")
Thanks