Posts: 3
Threads: 2
Joined: Jun 2013
Hi guys,
I'm a newbie just trying out getsimple for the first time. So far so good.
I want to use
Code:
<?php get_navigation(return_page_slug()); ?>
But I'd rather have it return plain links than list items and links. How can I change this?
thanks!
Posts: 6,266
Threads: 181
Joined: Sep 2011
Well you would have to make your own function to do that.
You could always simply style the list to look the same as links.
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-06-08, 01:17:47
(This post was last modified: 2013-06-08, 01:19:30 by Carlos.)
Anyway...
1. Create a text file named
mynavigation.php and paste this (a slightly modified version of GS's get_navigation) into it:
PHP Code:
<?php
// register plugin
$thisfile = basename(__FILE__, ".php");
register_plugin(
$thisfile,
'My Navigation','0.1','...','#','...'
);
function get_my_navigation($currentpage) {
$menu = '';
global $pagesArray;
$pagesSorted = subval_sort($pagesArray,'menuOrder');
if (count($pagesSorted) != 0) {
foreach ($pagesSorted as $page) {
$sel = ''; $classes = '';
$url_nav = $page['url'];
if ($page['menuStatus'] == 'Y') {
if ("$currentpage" == "$url_nav") { $classes = "current active ". $page['parent'] ." ". $url_nav; } else { $classes = trim($page['parent'] ." ". $url_nav); }
if ($page['menu'] == '') { $page['menu'] = $page['title']; }
if ($page['title'] == '') { $page['title'] = $page['menu']; }
$menu .= '<div class="'. $classes .'"><a href="'. find_url($page['url'],$page['parent']) . '" title="'. encode_quotes(cl($page['title'])) .'">'.strip_decode($page['menu']).'</a></div>'."\n";
}
}
}
echo exec_filter('menuitems',$menu);
}
// end of file
2. Upload the file to your plugins folder. Activate it.
3. Edit your template and replace:
Code:
<ul>
<?php get_navigation(return_page_slug()); ?>
</code>
[/php]
by:
[code]
<?php get_my_navigation(return_page_slug()); ?>
I'm not sure if I understood well. It reders div tags instead of li's. If it's not what you want, it's easy to customize.
Posts: 3
Threads: 2
Joined: Jun 2013
Thank you, that did the trick.
I tried to find GS's get_navigation so tha I could modify it or at least look at it, but I couldn't find it.
For future reference, where is it?
Posts: 6,266
Threads: 181
Joined: Sep 2011
admin/inc/theme_functions.php
Posts: 346
Threads: 27
Joined: Sep 2010
You could also use mvlcek's
i18n plugin and
custom render the navigation with a component (which saves you needing to create your own plugin whilst giving you all of the benefits of i18n).