Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
changing get_navigation
#3
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.
Reply


Messages In This Thread
changing get_navigation - by scrawler - 2013-06-08, 00:50:52
RE: changing get_navigation - by shawn_a - 2013-06-08, 01:12:31
RE: changing get_navigation - by Carlos - 2013-06-08, 01:17:47
RE: changing get_navigation - by scrawler - 2013-06-08, 02:09:32
RE: changing get_navigation - by shawn_a - 2013-06-08, 02:33:06
RE: changing get_navigation - by Angryboy - 2013-06-08, 16:20:07



Users browsing this thread: 1 Guest(s)