Duplicate WordPress Menus Across a Network of Sites

We recently had to duplicate WordPress menus across a network of sites, and found the available documentation on the matter lacking. In the spirit of bettering the WordPress community, I present the following code snippet.

The code snippet could be included in a plugin (that’s where we used it, to be triggered from the Dashboard), or as a use-once line in the functions.php file in your theme. It relies on being passed an array of ID’s that represent sites in your network.

global $wpdb;
//$blog_list is an array of ID's of sites on the network
foreach ($blog_list AS $blog_id)
{
  switch_to_blog($blog_id);
  wp_delete_nav_menu('YourNavName');//save some hassle, delete the menu if it already exists
  $navID = wp_create_nav_menu('YourNavName');
  $myPage = get_page_by_title('Page Title');//find a page to include in new menu
  if($myPage != null)//if we were successful in getting the page
  {
    $itemData =  array(
      'menu-item-object-id' => $myPage->ID,
      'menu-item-object' => 'page',
      'menu-item-type' => 'post_type',
      'menu-item-status' => 'publish'
    );
    wp_update_nav_menu_item($navID,0,$itemData);
  }
  //following section assigns your new menu to a theme location, so that it can show up on your site
  $locations = get_theme_mod('nav_menu_locations');
  $locations['nav_name'] = $navID;//where nav_name is the name of your menu
  set_theme_mod('nav_menu_locations', $locations);
}

Questions?

Milwaukee’s Online Creative Hub Launches

We’re happy to say that we’ve launched the Creative Alliance of Milwaukee’s new website, the Creative Hub. The Cultural Alliance of Greater Milwaukee contracted with us, Spreenkler, and Smartwave Consulting to develop a new platform for them online. Part of that process was merging their Creativity Works initiative with the rest of their organization to become Creative Alliance Milwaukee, Inc.

The site runs on WordPress and features a number of custom-developed plugins to enable the advanced functionality.

Adding PayPal Express Checkout to Magento

Adding PayPal’s Express Checkout to Magento is extremely easy. I was relieved to learn this after PayPal told a client that if they didn’t offer Express Checkout along with using Payments Pro their transaction rate would go up by .5% (the ethical considerations of PayPal forcing their paying customers to do this seems a bit unclear to me). Wanting to make sure I didn’t miss anything easy (we haven’t used Express Checkout before as our clients don’t generally like the big PayPal logo on their store) we just followed these simple steps, and we were done.

The moral of the story? Magento is easy, PayPal not so much.

Remove WordPress Admin Bar

Starting with WordPress 3.1, an administrative bar is included on the public facing side of the site for logged-in users. Unfortunately, I’ve yet to find anyone who finds this desirable.

How to get rid of the gray bar WordPress puts on the top of the screen? Add a simple line to your functions.php file.

add_filter( ‘show_admin_bar’, ‘__return_false’ );

If you do that, all is well in your world.

How To Create A Simple (Database Using) WordPress Plugin – Sample Code

At the January meeting of Web414 at Bucketworks, Jeramey gave a presentation on how to create a simple WordPress plugin. The plugin supports adding and listing members of the Web414 community using jQuery (AJAX).

The code is available to download in a super small zip file (web414.zip).

  1. It can be installed by uploading it to your “wp-content/plugins” folder, and activating it from your WordPress dashboard.
  2. It will require the creation of a database table in your WordPress database. You can see the structure of how to do that in included file (web414.php), and grab the code to copy and paste into PhpMyAdmin (if you like things quick and easy).
  3. To make the plugin appear on your site you will need to include two different shortcodes on any of your pages. They are “[add_web414member_finished]” and “[list_web414_members]”. Put them on any page and after activating the plugin they will appear. The add a member function will only appear to logged-in users.
  4. Extend this as you wish.

Let me know if you have any questions or comments, we would be happy to help you get starting writing WordPress plugins.

Character Limiting with TinyMCE

Looking to limit the number of characters easily in a TinyMCE instance?  Thankfully, there is a plugin for that.  Saved us enough time for a customer recently that it’s definitely worth sharing.

Ministar Refills

We recently launched a new website for a client of ours, Autopoint. They sell the hard-to-find ministar refills, as well as the ever popular 2-way multi-action pen.

Pecha Kucha Night 2

I had such a good time at the first event dedicated to showcasing people’s creative energy in under seven minutes, that I want to share with you information on the second.

Mark your calendars!
Tuesday, August 26, 2008
8:00 PM
Hi Hat Garage
1701 N. Arlington
Milwaukee
$10 in advance, $12 at the door

Register now at:
http://www.800ceoread.com/pechakucha1

PECHA KUCHA FEVER STRIKES MILWAUKEE AGAIN!

In June, 800-CEO-READ presented the first Pecha Kucha Night in Milwaukee to a sold-out crowd at Hi Hat Garage. The captivated audience watched eight presenters speak about a variety of topics including: an anarchist bird watching group, an obsession with department stores, the need for better Milwaukee recycling programs, the creation of an ideal work environment, and craftivism to change the world.

Now, 800-CEO-READ is pleased to present the second Pecha Kucha Night at the Hi Hat Garage on August 26, 2008 at 8:00 PM. On this night, ten people will take turns presenting their ideas through a unique presentation format using 20 slides that automatically change every 20 seconds. Pecha Kucha is an opportunity for people to discover the ideas of fellow community members and experience a new form of creative presentation that utilizes images, sound, and words within the restrictions of the “20 x 20” format.  The presentations are provocative, while the event is relaxed, including a “beer break,” where the presenters and the audience meet and discuss topics further over the beverage of their choice.

Presenters for the second Pecha Kucha in Milwaukee are:

Tuc Krueger, Katherine Biehl, Mark Lawson, Megan McGee, Brent Gohde, David Chirot, Jeff Larche, Will Weider, Kat Berger, Mike LeMoine.

See You At MilwaukeeDevHouse2

We look forward to seeing you at MilwaukeeDevHouse2 on May 31st starting at 6 p.m. at Bucketworks on 1340 N. Sixth Street.

MilwaukeeDevHouse aims to be the premier regularly scheduled hackathon event that combines serious and not-so-serious productivity with a fun and exciting party atmosphere.

If you’re a coder, designer, or just someone who enjoys software and technology development, MilwaukeeDevHouse was made for you.

We’ll be there, will you?

See Us At Flourish 2008

Itching to attend a technology conference? Interested in open-source technology? We’ll be at Flourish 2008 at the University of Illinois – Chicago in right outside of the loop in urban Chicago. If you want to meet-up, drop a comment here and leave a way for us to get in contact with you.