August 24th, 2010 |
Published in
Life of Lew Ayotte, humor, technology
I have been certified as one of the three most important people in WordPress!
From Matt Mullenweg’s hands, to your eyes; read’em and weep!

Tags: certificate, matt mullenweg, wordpress
Warning: Invalid argument supplied for foreach() in /homepages/3/d238924033/htdocs/lewayotte.com/wp-content/plugins/yet-another-related-posts-plugin/magic.php on line 54
August 11th, 2010 |
Published in
technology
If you are using switch_to_blog() in your WordPress MultiSite installation and notice that your permalinks contain “/blog/” in them (or some other oddity). The give John James Jacoby’s plugin Switch Site Rewrite a go.
Today I ran into this problem with a WPMS site that I am developing. I needed to pull posts from the “news” site onto the main site. I used switch_to_blog() to do this, but when I tried to get specific category permalinks with get_category_links() it would automatically include “/blog/” in the URL.
This is because of the way that the $wp_rewrite variable is initialized and an attempt to reduce overhead when using switch_to_blog(). So, John’s plugin does come with a risk of added overhead, but I’m currently dealing with a 30 site installation and don’t see much of a cost. If you were really picky, you could modify his code a bit to only work in real specific situations.
If you get a chance, jump on over to twitter and thank him for this little plugin. It saved me a little more development work, although it also meant I wasted 2 hours tracking down the problem :).
Tags: get_category_links, permalinks, plugin, switch_to_blog, twitter, wordpress, wpms
Warning: Invalid argument supplied for foreach() in /homepages/3/d238924033/htdocs/lewayotte.com/wp-content/plugins/yet-another-related-posts-plugin/magic.php on line 54
July 29th, 2010 |
Published in
technology
I’ve been working on a pretty complicated WordPress Multi-Site project for the College of Education at UGA. One of their sites will be controlling the master calendar for the main website. We wanted to display the calendar from the sub-site. One the main site of the page (an possibly on other sub-sites).
Generally speaking, in WPMS / WPMU you can get the content of one site by switching to that site ID using the switch_to_blog($id) function. However, this does not work with Event Calendar 3, because of the way it builds it’s global $ec3 variable.
The problem is, when you are on site id 1, the $ec3 creates a variable that points to the schedule table for site id 1. Even if you run switch_to_blog(2), $ec3 still tries to get the schedule from site id 1. So it was returning an empty calendar. The easiest way to fix this (until EC3 updates their code) was to re-instantiate the global $ec3 variable. Basically this is what I did:
switch_to_blog(10);
global $ec3;
$ec3 = new ec3_Options();
ec3_get_calendar();
restore_current_blog();
This re-instantiates the $ec3 variable for the schedule I needed to get from that specific site ID. It should be a fairly simple fix for EC3. Until then, this is the easiest fix if you need to do what I’m doing.
Tags: event calendar 3, switch_to_blog, wordpress, wpms, wpmu
Warning: Invalid argument supplied for foreach() in /homepages/3/d238924033/htdocs/lewayotte.com/wp-content/plugins/yet-another-related-posts-plugin/magic.php on line 54
July 14th, 2010 |
Published in
technology
If you do not keep up with WordPress drama, then you missed the big debate today between Matt Mullenweg of Automattic/WordPress and Chris Pearson of DIY Themes/Thesis. There has been a long standing issue with the Thesis theme not being GPL compliant, while WordPress is. Mullenweg has asked Pearson to comply with the license which lead to a heated debate over twitter and eventually via a video interview on Justin.TV hosted at Mixergy.com.
During the debate, Pearson admitted that he was “arguably one of the top three most important people in the history of WordPress” — Mullenweg and Mark Jaquith being the other two. Well, many people in the WordPress community took issue with this, so I decided to create a t-shirt design of this quote as a parody. I think it is safe to say that anyone in the WordPress community can wear this t-shirt with pride… because the people are the most important people in WordPress. That is one of the main reasons WordPress is so successful!
It is currently available at CafePress (where you can get the design as more than just a t-shirt):
Tags: drama, gpl, mullenweg, opensource, pearson, thesis, wordpress
Warning: Invalid argument supplied for foreach() in /homepages/3/d238924033/htdocs/lewayotte.com/wp-content/plugins/yet-another-related-posts-plugin/magic.php on line 54
July 11th, 2010 |
Published in
technology
Usually I’d just call the wp_tag_cloud() function manually from a WordPress theme file, but I have a client who wants to use the Tag Cloud Widget on their site. The tag cloud widget has been in WordPress since WP 2.3. Unfortunately, it isn’t the easiest widget to use because you can’t customize it from the backend.
Luckily there are two filters that can be used to set the arguments your client needs and maintain the ability for them to modify the widget location from the WordPress backend.
- widget_tag_cloud_args – lets you set the wp_tag_cloud arguments
- wp_tag_cloud – lets you edit the wp_tag_cloud output
So, for my clients need’s, I just needed to set the small and large font size arguments and change the widget output a little to fit their sidebar properly. I added these lines to the theme’s function.php:
function tag_cloud_args() {
$args = array( 'smallest' => 8, 'largest' => 14 );
return $args;
}
add_filter('widget_tag_cloud_args', 'tag_cloud_args');
function tag_cloud($return) {
$return = "<div class="box menu tags">" . $return . "</div>";
return $return;
}
add_filter('wp_tag_cloud', 'tag_cloud');
As with any function in WordPress, be sure to check out the codex for all the Tag Cloud Arguments that you can use.
Tags: add_filter, apply_filters, tag cloud, wordpress, wp_tag_cloud
Warning: Invalid argument supplied for foreach() in /homepages/3/d238924033/htdocs/lewayotte.com/wp-content/plugins/yet-another-related-posts-plugin/magic.php on line 54