moveableTypeSq

Exporting Moveable Type Blog Posts with Tags

This script (MtTaggedExport.php) creates a Moveable Type blog export file with tags added to the keywords field.The default MT export contains keywords and categories, but not tags. WP imports keywords as tags, so we’re going to put the MT tags into the keywords area. Everything else in the tagged export file should be exactly the same as the default export file (see notes for exceptions).

This script is for people who have been given an exported MT database but do not have admin access to the actual MT site. (If you have access to your MT installation, it is probably much easier to create custom export template [or “index template”] and do a little grep after. See this foliovision.com article and template example.)

Continue reading

wordpress100

WordPress NYC Genius Bar Notes

Genius Bar from 09.20.11 WordPress NYC Meetup

The formal presentation was “A beginners overview”. There was an introduction about the many ways you can interact with the WPNYC community. Then we split off to the Genius Bar.

I was expecting a bunch of self-dubbed geniuses to be discussing advanced WP topics. Instead, it was more like Apple’s Genius Bar, with about 15 people waiting to ask the geniuses their WP questions. Most of the people seemed to be designers. There were two developers (Steve Bruner, the organizer, and Kevin Cristiano) who were very patient and helpful. Most of the questions were regarding plugins. These are not direct quotes. And the plugin spellings might be wrong.

  1. “What video plugin should I use for .mov files? WP won’t let me upload anything larger than 8 MB and I’ve been converting them to .fla … I don’t want to use Youtube/Vimeo because of I want particular privacy/sharing options.”
    • Jw-player plugin is standard for video, uses HTML5, free/licensed version for business. Also, JPlayer & VideoJS are recommended.
    • For reducing the file size, someone recommended using an online file convertor. They said that Dreamhost provides one in the control panel.
    • Some debate as to where the file size limit is set (in WP or the host’s PHP settings).
    • Some debate as to whether YouTube has separate privacy settings for each video (it does).
  2. “My Google Analytics plugin doesn’t work.”
    • Try: Ultimate Google Analytics, Google Analyticator, Google Analytics for WP
    • You don’t actually need a plugin

Continue reading

wordpress100

catch_that_image() Fix

catch_that_image() is a PHP function for WordPress that displays the first image of a post, so that you can create a gallery from your latest posts. It works quite well until someone goes crazy and uses special characters in their image filename.

You could try to establish file naming conventions, or you could stop being a masochist & modify the function. All that needs to be changed is a .* to [^>]*.

Here is the complete catch_that_image() function with the fix (it goes in your functions.php file):

function catch_that_image() {
	 global $post, $posts;
	 $first_img = '';
	 ob_start();
	 ob_end_clean();
	 $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"][^>]*>/i', $post->post_content, $matches);
	 $first_img = $matches [1] [0];

	 if(empty($first_img)){ //Defines a default image
		  $first_img = "/images/default.jpg";
	 }
	 return $first_img;
}

Call the function wherever you want in your theme files:

<?php echo catch_that_image() ?>

Easy!

Notes

wordpress100

Limit WordPress Search Scope to Blog Posts

When using get_search_form(), WordPress returns results from all pages and posts. To force WordPress to return results only from posts, copy & paste the code below into your theme’s function.php file. Create a new function.php file if you don’t have one.

&lt;?php
function SearchFilter($query) {
     if ($query->is_search) {
          $query->set('post_type','post');
     }
     return $query;
}
add_filter('pre_get_posts','SearchFilter');
?>

To limit the search to page content only, change line 4 to $query->set('post_type','page'); .

Notes