help setting accesskeys

This is a discussion on "help setting accesskeys" within the PHP Forum section. This forum, and the thread "help setting accesskeys are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 8th, 2008, 11:41
minute44's Avatar
Moderator
Join Date: Apr 2006
Location: Nottingham UK
Age: 24
Posts: 1,347
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to minute44
help setting accesskeys

I want to set accesskeys for my main navigation. I can do it if I substitute the PHP it has that builds the list of pages with static HTML but if I do that I lose the current page link state.

At the moment the Nav is like this:

PHP: Select all

<ul>
<?php if (is_home()) { ?>
<li class="current_page_item"><a href="<?php bloginfo('home'); ?>">Home</a></li>
<?php } else { ?>
<li><a href="<?php bloginfo('home'); ?>">Home</a></li>
<?php ?>
<?php wp_list_pages
('sort_column=menu_order&depth=1&title_li='); ?>
</ul>
I can change it to this:

HTML: Select all
<ul>
<li><a href="http://www.minute44.com" accesskey="1">Home</a></li>
<li><a href="http://www.minute44.com/about" accesskey="2">About Me</a></li>
<li><a href="http://www.minute44.com/galleries" accesskey="3">Galleries</a></li>
<li><a href="http://www.minute44.com/shout-up" accesskey="4">Shout Up</a></li>
</ul>
but obviously I lose the effect of the current page link appearing different.

Can anyone see a way for me to alter the php in the first one so that it assigns the links accesskeys 1-4?

Cheers

Dan
Last Blog Entry: Annoying people.... (Jan 16th, 2008)
Reply With Quote

  #2 (permalink)  
Old Jan 8th, 2008, 12:49
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: help setting accesskeys

Well the first one is easy:
HTML: Select all
<ul>
<?php if (is_home()) { ?>
<li class="current_page_item"><a href="<?php bloginfo('home'); ?>" accesskey="1">Home</a></li>
<?php } else { ?>
<li><a href="<?php bloginfo('home'); ?>" accesskey="1">Home</a></li>
<?php } ?>
<?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
</ul>
For the rest of the links, you'll have to modify the "wp_list_pages" function. If you post the code here I'm sure we can figure something out....
Reply With Quote
  #3 (permalink)  
Old Jan 8th, 2008, 13:15
minute44's Avatar
Moderator
Join Date: Apr 2006
Location: Nottingham UK
Age: 24
Posts: 1,347
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to minute44
Re: help setting accesskeys

Just trying to find the file that contains the function.

Last Blog Entry: Annoying people.... (Jan 16th, 2008)
Reply With Quote
  #4 (permalink)  
Old Jan 8th, 2008, 13:20
minute44's Avatar
Moderator
Join Date: Apr 2006
Location: Nottingham UK
Age: 24
Posts: 1,347
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to minute44
Re: help setting accesskeys

OK, here's the function:

PHP: Select all

function wp_list_pages($args '') {
    
$defaults = array(
        
'depth' => 0'show_date' => '',
        
'date_format' => get_option('date_format'),
        
'child_of' => 0'exclude' => '',
        
'title_li' => __('Pages'), 'echo' => 1,
        
'authors' => '''sort_column' => 'menu_order, post_title'
    
);

    
$r wp_parse_args$args$defaults );
    
extract$rEXTR_SKIP );

    
$output '';
    
$current_page 0;

    
// sanitize, mostly to keep spaces out
    
$r['exclude'] = preg_replace('[^0-9,]'''$r['exclude']);

    
// Allow plugins to filter an array of excluded pages
    
$r['exclude'] = implode(','apply_filters('wp_list_pages_excludes'explode(','$r['exclude'])));

    
// Query pages.
    
$pages get_pages($r);

    if ( !empty(
$pages) ) {
        if ( 
$r['title_li'] )
            
$output .= '<li class="pagenav">' $r['title_li'] . '<ul>';

        global 
$wp_query;
        if ( 
is_page() )
            
$current_page $wp_query->get_queried_object_id();
        
$output .= walk_page_tree($pages$r['depth'], $current_page$r);

        if ( 
$r['title_li'] )
            
$output .= '</ul></li>';
    }

    
$output apply_filters('wp_list_pages'$output);

    if ( 
$r['echo'] )
        echo 
$output;
    else
        return 
$output;

Last Blog Entry: Annoying people.... (Jan 16th, 2008)
Reply With Quote
  #5 (permalink)  
Old Jan 8th, 2008, 14:55
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: help setting accesskeys

OK, As far as i can tell the pages get added here:
PHP: Select all

$output .= walk_page_tree($pages$r['depth'], $current_page$r); 

Let's check out that function.....
Reply With Quote
  #6 (permalink)  
Old Jan 8th, 2008, 14:57
minute44's Avatar
Moderator
Join Date: Apr 2006
Location: Nottingham UK
Age: 24
Posts: 1,347
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to minute44
Re: help setting accesskeys

You know what? I can't be arsed with this anymore. Too much work to add a farting little feature that is useless to 99.99% of users and could very well harm my existing accessibility.
Last Blog Entry: Annoying people.... (Jan 16th, 2008)
Reply With Quote
  #7 (permalink)  
Old Jan 8th, 2008, 16:10
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: help setting accesskeys

ok....
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up to run javascript PutjatDa JavaScript Forum 2 Jun 8th, 2007 08:42
email setting help pls!!! norms1982 Starting Out 7 May 7th, 2007 15:43
PHP E-mail setting ??? j4mes_bond25 PHP Forum 0 May 29th, 2006 13:51
Setting up a forum cyberseed Web Page Design 5 Jul 26th, 2005 20:13


All times are GMT. The time now is 05:35.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43