Marco.org (With Comments)

I love Marco.org, and I also love Daring Fireball with Comments

Marco.org (with Comments)…so I created Marco.org (with Comments)!

Install the extension for Safari or Chrome and you’ll have Disqus-based comments on Marco.org!

To help keep the conversation civil, rude words lead to moderated comments.  I look forward to our discussions.

- Zack Katz

Marco.org (with Comments) Safari Extension

Marco.org (with Comments) Chrome Extension

Posted in Blogging, Mac, Personal | Tagged , , , , , | Leave a comment

Toggle WordPress Help Menu

It’s not possible (as far as I know) to currently link directly to a help tab in WordPress. Here’s the jQuery solution I cooked up:

/**
 * Toggle the WP help menu tab by linking to the tab id
 * 
 * The anchor must have a rel of wp-help
 */
$('a[rel="wp-help"]').click(function() 
		$('#contextual-help-link').click();
	
	
	// Click on the tab link inside the help wrapper
	$('#screen-meta a[href*="' + $(this).attr('href').replace('#', '') +'"]').click();
	
	// We're just anchor linking; don't go anywhere
	return false;
);

If the tab’s ID that you pass to $screen->add_help_tab() is example-plugin, then you could create a link like this: <a href="#example-plugin" rel="wp-help">View the help docs</a>.

Posted in jQuery, WordPress | Tagged , , | Leave a comment

Bradycardia & Cardiac Arrest for WordPress 3.6

Bradycardia is the resting heart rate of under 60 beats per minute….
Wikipedia

WordPress HeartbeatA new feature in WordPress 3.6 is an upgrade to the autosave functionality that’s been around for years. It’s called “Heartbeat” and it makes sure you have valid authentication credentials, aren’t working on the same post as other people, and more. The problem is that (as it is) it slows web pages down to a grinding halt.

Read the active discussion on WordPress.org about this feature - a lot of people are upset about the CPU load it adds.

Note: I don’t recommend doing these changes on every Admin page. Use sparingly.

Slow Down WordPress 3.6′s Racing Heartbeat

Here’s how to slow down the heartbeat from once every 15 seconds (the default) to once every minute (the max allowed by WordPress): Continue reading

Posted in WordPress | Tagged , , , | 4 Comments

Add “Preview” Link to Manage Themes

Get That Preview Link Back!

Ever since WordPress added a Live Preview option to the Manage Themes screen, it’s been frustrating to test a plugin using multiple themes.

Why Live Preview sucks for developers

When using Live Preview, you can’t modify the URL of the page you’re visiting or open the preview in a new window or tab. Live Preview prevents you from viewing multiple themes at once in different tabs.

If you wanted to get the old Preview link back, you had to disable Javascript, then refresh the page, then open the links.  Continue reading

Posted in WordPress | Tagged , , , | Leave a comment

How to Email Pictures from iPhoto Using Mail.app

Update: If you are using iPhoto 11, you can simply go to "Preferences > Email photos using"

Update: If you are using iPhoto 11, you can simply go to Preferences > “Email photos using”

iPhoto Email Fail

iPhoto Mail App

The Best Kitties; The Worst Email App

iPhoto 11 added an awful new built-in email service that replaces the previous functionality: when sending an email, it used to open the Mail application and attach the photos to a new email. Now, it uses a terribly designed built-in email functionality that ruins everything.

Here’s how to get Mail.app back in iPhoto

Open the Terminal application.

Enter the following in Terminal: defaults write com.apple.iPhoto EmailApp Mail

Restart iPhoto and you’re all set.

If you change your mind, and you want to revert to using iPhoto’s email client, enter this in the Terminal: defaults write com.apple.iPhoto EmailApp iPhoto

Posted in Mac | Tagged , , , | 5 Comments

How to Hide or Replace the WordPress Welcome Panel

Updated: now with more in-depth code!

So you want to modify the WordPress Dashboard Welcome Screen

There was a thread on the WPMU website that discusses how to disable the WordPress welcome screen, but the code provided didn’t work, so I figured I’d show how to do it!

The wp_welcome_panel() function uses the show_welcome_panel user meta setting to determine whether or not to show the welcome panel.  In order to modify this setting, we’re going to add a filter to the get_user_metadata filter, which uses the get_metadata function.

The following code snippets should be added to your theme’s functions.php file.

Disable the dashboard welcome screen…

This will only hide the panel, not replace it with any other content.

add_filter("get_user_metadata", "my_own_welcome_panel", 1, 4);

function my_own_welcome_panel($null, $object_id, $meta_key, $single) {
	if($meta_key === 'my_own_welcome_panel') { return 0; }
}

or Show Your Own Panel

You can replace the WP welcome panel with your own content using this snippet.

add_filter("get_user_metadata", "my_own_welcome_panel", 1, 4);
function my_own_welcome_panel($null, $object_id, $meta_key, $single) {
	
	// Only work with the show_welcome_panel
	if($meta_key !== 'show_welcome_panel') { return null; }

	// If the user has already said they don't want to see the panel, don't show it!
	$show_panel = get_user_meta( get_current_user_id(), 'my_own_welcome_panel', true );
	if(empty($show_panel)) { return 0; }

	// Echo your HTML or content here, but make sure to have a link like the following:
	?>
	<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?my_own_welcome=0' ) ); ?>"><?php _e('Dismiss this Message'); ?></a>
	<?php

	// Return 0 or else the original welcome panel will show as well.
	return 0;
}

// Add the functionality to update the user's settings with whether or not they have closed the panel
add_action('admin_init', 'my_own_welcome_set_welcome_panel');
function my_own_welcome_set_welcome_panel() {
	if ( isset( $_GET['my_own_welcome'] ) ) {
		update_user_meta( get_current_user_id(), 'my_own_welcome_panel', intval($_GET['my_own_welcome']));
	}
}
Posted in Tutorial, Uncategorized, WordPress | Tagged | 5 Comments

Major Changes in the WordPress.org Plugin Directory

The new plugin Reviews feature suggests a shifting approach to the WordPress ecosystem.

Reviews: a new tab in town

WordPress.org Reviews TabOn every plugin page, there is now a Reviews tab. This is in addition to the Support tab that WordPress added around August.

Rating a plugin now requires a review

Until now, WordPress reviews were basic: 1-5 stars, with no additional details. You would only need to be signed in and click a star rating. With this change, WordPress.org requires users to be logged in and to write a review with their star rating. This will force users to be more thoughtful on why they rate a plugin a certain way.

You can now reply to reviews. Nice.Each review is now a forum thread: when a review is posted, the plugin author has a chance to reply. This is great for me as a plugin author: I can attempt to  resolve issues and get better plugin ratings. Users are able to modify their reviews and update their star ratings, which adds incentive for plugin authors to address issues with each reviewer. This is smart.

The beginning of higher accountability.

This is one way to add security and stability to the WordPress ecosystem.

I believe WordPress wants to have more tight controls over the plugins listed on the directory.  With over 22,000 plugins, Automattic simply does not have the resources to make sure all plugins are up to snuff.

The WordPress team has taken steps to help users know whether a plugin is good or not:

  • The May update made visible the number of resolved plugin support requests over a time span.
  • Earlier in the year, the website started displayed a banner alerting users when a plugin hadn’t been updated in over two years.
  • In 2011, the website started showing a graph of the plugin star ratings, not just the aggregated star rating. This helped visualize the plugin’s ratings.

WordPress as a platform.

Matt Mullenweg spoke at a WordCamp recently about his vision for auto-updating WordPress where users wouldn’t have to manually upgrade the software. His vision is of WordPress as a hassle-free platform, and I bet that reducing the variables added by troublesome plugins or themes is a high priority.

WordPress 3.5, currently in beta, introduces a new feature (emphasis mine):

You can browse and install plugins you’ve marked as favorites on WordPress.org, directly from your dashboard.

This feature, in concert with more in-depth reviews, marks a shift from a directory of plugin downloads to more of a WordPress “App Store” mentality: when you are logged in to your account, you can easily find and download your favorite plugins. The directory, armed with better ratings and review, will show higher-rated plugins first. All from inside WordPress instead of on the WordPress.org website.

This reviews implementation is a big next for the plugin directory, and is likely the first  step of many. I look forward to seeing what is planned for the directory, as well as the WordPress platform as a whole.


Notes as a Plugin Developer

  • On each plugin page, you can grab an RSS feed of the reviews, which will be helpful for responding to review comments. This is functionally similar to the plugin Support forum.
  • I really, really like this change. It will help good plugins get discovered.
  • Plugin authors can now respond to their critics! Re: Marco Arment.

Feature Request: Per-Version Ratings

Each review prominently displays the date of the review. I’m hoping that WordPress segment reviews on a per-version basis, like what Apple does in their App Store. There would be two charts: ratings for all versions, and ratings for the current version.

Posted in WordPress | Tagged , , , | 2 Comments

Prevent Refresh from Adding Another Product in WooCommerce

Prevent items from being mistakenly added to the cart multiple times.

Mountain America Jerky uses the WooCommerce eCommerce plugin for WordPress, and they were having an issue: when users added a product to their cart then refreshed, the item was being added again. Also, when customers added items to their cart, then hit back, they got the dreaded “Confirm Form Resubmission” notice.

To solve this issue, I added a redirection when users added products to their cart. The code hooks into WooCommerce’s woocommerce_add_to_cart_action function, located in /woocommerce/woocommerce-functions.php.

Here’s the code that you should add to your theme’s functions.php file, or to your own custom plugin:

add_action('add_to_cart_redirect', 'resolve_dupes_add_to_cart_redirect');

function resolve_dupes_add_to_cart_redirect($url = false) {

     // If another plugin beats us to the punch, let them have their way with the URL
     if(!empty($url)) { return $url; }

     // Redirect back to the original page, without the 'add-to-cart' parameter.
     // We add the get_bloginfo part so it saves a redirect on https:// sites.
     return get_bloginfo('wpurl').add_query_arg(array(), remove_query_arg('add-to-cart'));

}

I hope this helps someone else with the same issue!

Posted in Code | Tagged , , | Leave a comment

A Gravity Forms Add-on: Change Who Created An Entry

Download the “Change Entry Creator” Gravity Forms Add-on

Change User for an Entry In Gravity Forms

This simple plugin allows you to edit who created an entry in Gravity Forms.

When you have an entry from Gravity Forms that you want to edit, you can edit almost anything, except for the entry assignment; who created the entry.

Activate the plugin and you will see a drop-down input with each user on your site.

  • Only users with entry entry editing capability will be able to see the drop-down and edit the entry (the gravityforms_edit_entries capability)
  • Select a new user from the drop-down, update the entry, and the entry creator will be updated.
  • A note will be added to the entry with the following information:
    • Who changed the entry creator
    • When the change took place
    • Who the previous entry creator was

Simply upload the plugin, activate it, and you’ll see the drop-down in the Edit Lead “Info” box.

Posted in Gravity Forms | Tagged , , | 4 Comments

How to Change the Width of the Reading List Sidebar in Safari

For the record, I know this is a silly hack.

Add a new item to the ~/Library/Preferences/com.apple.Safari.plist file:

Key: SidebarSplitViewDividerPosition 
Type: "Number"
Value: 400

For the value, use whatever width you want in the number of pixels. I think I like 400.

Posted in Mac | Tagged , , | Leave a comment