Category: WordPress
No Comments

I’ve been developing with WordPress for about 2.5 yrs and this morning I really wanted to write something about all the work that I do, but am realizing that I just don’t know what to say with out writing a freaking book on the DevTime of WordPress. Not to mention there are so many people out there who have already laid down the law on what WordPress is.

So to curb my need to publish I though I would share a WP function that I have found to be a huge time saver, and something WP uses a lot. As you’ll see below it’s not much to speak of and it’s fairly basic in the scheme of things, but it will save a lot of time when comparing incoming variables with default variables.

wp_parse_args()

You can find this in wp-includes/functions.php -> line 2887 wp3.0 beta1


/**
* Merge user defined arguments into defaults array.
*
* This function is used throughout WordPress to allow for both string or array
* to be merged into another array.
*
* @since 2.2.0
*
* @param string|array $args Value to merge with $defaults
* @param array $defaults Array that serves as the defaults.
* @return array Merged user defined values with defaults.
*/
function wp_parse_args( $args, $defaults = '' ) {
if ( is_object( $args ) )
$r = get_object_vars( $args );
elseif ( is_array( $args ) )
$r =& $args;
else
wp_parse_str( $args, $r );

if ( is_array( $defaults ) )
return array_merge( $defaults, $r );
return $r;
}

Here is an example being used in the form function of a widget class, which is a great place to set defaults variables.


function form( $instance ) {

$widget_options = get_option('_my_widget_options');

//Defaults
$defaults = array(
'title_display' => 'Text',
'text_title' => '',
'image_title' => '',
'link' => '',
'post_cat' => $widget_options['post_cat'],
'post_count' => $widget_options['post_count'],
'word_count' => $widget_options['word_count'],
'read_more' => $widget_options['read_more'],
'strip_tags' => $widget_options['strip_tags'],
'show_thumbnail' => '',
'show_video' => '',
'css_class' => ''
);

$r = wp_parse_args( $instance, $defaults );
extract( $r, EXTR_SKIP );

echo 'do cool stuff here...';
}

So yeah, really exciting stuff right? Maybe not, but hey if you’re into php & WordPress you should check this out for sure. It’s been around for while so there is really no excuse.

Category: Themes, WordPress
No Comments

I’ve been on the keyboard for the last 3.5 months and it’s been quite a crazy time. So far 2010 has been more busy then I ever expected. My recent work has been expanding my theme by leaps and bounds. It’s odd that every site I build kills all the previous ones. (it’s almost time to update my site, I just wish I had some time :)

There is a lot to go over so I’ll just list off the latest projects. (Most of these are Skörinc, but one or two came from BuzzPlant)

Category: Technology
4 Comments

Let me just start off by saying that I’ve been a loyal MobileMe user since 2001. I’m not any kind of guru, but I’ve been around long enough to notice that my MobileMe account really hasn’t been worth the $100 it used to be.

Google Sync has been out for quite a while at this point so I’m pretty sure I’m not going to say anything new so I’ll just give a quick outline of what I did and why. (not to mention, I’m really not that great of a writer.)

One thing to note, I used my visualcoma.com Google Apps Account for all of this so if you only have a gmail or simple Google account some things will be a smidg different.

A Second thing to note is that I have ditched iCal and moved to BusyCal. BusyCal has made connecting to Google so simple it’s retarded. Perhaps iCal is easy too, but the “How To” has more than one step so,, nope…

Google Sync: Setting Up Your iPhone

This step was a little confusing, and a little scary.. I synced my phone with itunes before I went any further, and I suggest you do the same. Before I continued with the full set up, I had to import my Calendars & Contacts into my Google Account. Once I had everything in my Google Account I completed all the steps for the sync including “Deleting Contact” & “Deleting Calendars”. Keep in mind that you have everything backed up on your computer and you have imported everything to Google so you technically have two backups.

I will fully admit that this was a little stressful when it came to hitting that red delete button, but once I was done and checked my Calendar and my Contacts on my phone I took a huge sigh of relief.

Here are a few factors to keep in mind.
  1. The iPhone will only allow for one Microsoft Exchange Account, so be sure you set up this system with the Calendars that you use the most.
  2. Back up your iPhone before you do anything!!!
  3. You will have to Sync your Phone with your Computer one last time after you have updated your Calendars and Contacts to Google
  4. Don’t forget to “Sync Google Contact” from iTunes/Info/Contacts
  5. Try out BusyCal unless you just have a thing for iCal.
  6. You can export you Mac Address book into a VCard and import it to Google Contacts.
  7. Halfway down this page you’ll find instructions on how to sync more than one calendar using Exchange.