Add links to a wordpress navigation menu

Someone asked me how to add links to the end of a WordPress (2.9) navigation menu.  I looked for a plugin but it really wouldn’t work well as they’d hacked their theme code.  I came up with this.

<?php
function draw_navigation() {
     $links = array(
         'Simple'=>'http://digitalsimple.info',
         'Twitter'=>'http://twitter.com/DigitalSimple'
    );
?>
<ul id="nav">
     <li <?php if(is_home()) { ?> <?php } ?>><a href="<?php echo get_option('home'); ?>/">Home</a></li>
<?php
     wp_list_pages('depth=1&sort_column=menu_order&title_li=' );
     foreach($links as $title=>$url) {
           echo '<li><a href="'.$url.'">'.$title.'</a></li>';
     }
     ?>
</ul>
<?php
}

draw_navigation();
?>

I’ll get this into a plugin eventually.

Web Development | , , , , , | Leave a comment

Module Errors after Drupal Updates

I host most of my client’s websites at MediaTemple on WordPress.  I do have a few Drupal sites that I manage and have run into an interesting problem.

When I update the drupal core I start getting errors that shouldn’t be there on Modules that should be fine.

To explain: Upgrading the drupal core involves (among other things) deleting a bunch of files and replacing them with new ones.   If your hosting company (like  MT) supports multiple PHP versions (probably 4 and 5) this update will force your PHP version back to version 4 and cause your modules to screw up.

As soon as I set my PHP version back to 5 all is well.

Hosting, Web Development | , , , | Leave a comment

Page Almost Loads

I noticed something on my WordPress sites the other day that was incredibly frustrating.  Some of them (I have several) would ALMOST load, then they’d hang for a few minutes before finally loading.

After searching and using all sorts of tools to watch the page load I discovered that for some reason the Javascript library for the NEXTGen Picture gallery was causing the hang up on WordPress 2.8.6 .  I’m not sure why but as soon as I disabled that feature everything came roaring back.

You can disable the Javascript on the options page under the gallery tab

NEXTGen-Javascript

I’m still looking into why, but it’s a quick fix.

Web Development | , , , , | Leave a comment

Disappearing “Site Admin” menu

Site-adminHere’s a good place to start.  I’m an administrator for a WordPress MU installation.  Today I tried to log into the main blog with my Site Admin account – the “super site account” that should be able to access all the blogs and sites – and discovered that my admin account was getting rejected.  I would see a screen that just said “Cheatin Uh?”

CheatinWhen I tried to log into one of the “sub” blogs, I  could get om but couldn’t see my “Site Admin” menu. (pause for groans and so forth).  After A LOT of poking around online I found a few helpful tips that got me back on my feet.  This is a problem in two acts.

Act 1. Can’t Sign In

It turns out that my access issues were plugin related.  I’m not sure what plugin was causing this but I found an article on disabling plugins using the database.  Specifically:

  • Use phpMyAdmin
    • In the table wp_options, under the option_name column (field) find the active_plugins row
    • Change the option_value field to: a:0:{}

In WordPress MU this is actually the wp_1_options table (“1″ being the first blog of the installation).  once I made this change I was able to log in.  Unfortunately I’d lost my “Site Admin” privileges.

Act 2. Site Admin menu missing

Again with the digging except this time I couldn’t find any help. Finally I was able to temporarily bypass security and make myself a Site Admin again.  Here’s what I did.

In your wordpress folder find the /wp-admin/wpmu-edit.php file and comment out this code

if( is_site_admin() == false ) {
wp_die( __('You do not have permission to access this page.') );
}

Next find the /wp-admin/wpmu-options.php file and do the same.

Once that’s done: You should be able to brows to http://(your domain here)/wp-admin/wpmu-options.php and scroll down to the bottom   You’re looking for this:

admin-settingsAdd your admin account (all lower case letters) and click “Update Options”

….

I don’t know if that will solve your problem but it did for me.  Once you’re back in don’t forget to go back and fix the code you changed.

Good Luck!

Web Development | , , , , , | Leave a comment

Hello world!

Hahahaha!  That’s about as good as it’s going to get.  As “simple”.  This is not a place for easy “Hello World” type posts.  This is a place for mind-numbing, fist-pounding issues that I run across in my network-admin, web-developer, computer-support life.

Enjoy; and I hope something somewhere here saves someone a little advil.

Uncategorized | Leave a comment