Support » Plugins » My Jump Menu Needs A Brain

  • Resolved foodin65


    Hello All,

    I’m in the process of developing a simple plugin for a network of sites that I host using WordPress 3.0RC1.

    The plugin is quite simple at the moment. All it does is have the name of the parent site in the network and a Jump menu of other important sites in the network.

    My Jump Menu is kinda dumb though as I’ve just written it in HTML. I need it to be dynamic. Currently it doesn’t know which site it’s on and so it always thinks it’s on the first site listed in the menu… which pretty much makes the jump menu useless.

    I’ve pasted my whole plugin code here:

    I didn’t post the CSS, but you can see the CSS with firebug here: – NSFW (no pictures, just uses the word Foreskin in the title – information only site).

    Can someone help he give my jump menu a brain?

    I have more questions and things I’d like to do with this plugin… but that’s a different topic for a different time.

Viewing 1 replies (of 1 total)
  • I think i can help you with this, you need to reposition your code, it’s currently printing out the menu into the head of the document(which is invalid).

    I assume the reason you hooked onto wp_head, is because you couldn’t find another way to hook the menu into a header position across all pages, you could hook onto the get_header action instead.

    I’ve re-written part of the function for you and updated the action, you’ll need to test to let me know if it works ok.

    function MyFrnHeaderBar (){
    	$site_links = array(
    		'Select a site' => '',
    		'' => '',
    		'MFCommunity' => '',
    		'Powdered Pull Balls' => ''
    	$current_site = get_bloginfo('wpurl');
    	<div id="myfrnheader">
    		<div id="myfrnheader_title"><a href="" title=""> Sites</a>:</div>
    		<form name="Jump" action="" id="myfrnheader_jumpmenu_form">
    			<div id="myfrnheader_jumpmenu_container">
    				<select name="Menu" onchange="location=document.Jump.Menu.options[document.Jump.Menu.selectedIndex].value;" id="myfrnheader_jumpmenu">
    					<?php foreach( $site_links as $name => $link ) : ?>
    					<?php $selected = ( $current_site == $link ) ? 'selected="selected" ' : ''; // Shorthand if/else for setting var ?>
    					<option <?php echo $selected; ?>value="<?php echo $link ?>">
    						<?php echo $name ?>
    					<?php endforeach; ?>
    		<div id="fancynav">
    add_action( 'get_header', 'MyFrnHeaderBar' );

    Havn’t touched the other function or action, so just leave those as is..

Viewing 1 replies (of 1 total)
  • The topic ‘My Jump Menu Needs A Brain’ is closed to new replies.