Textile lists without the rest

14 July 2008 6:49 PM (5 days, 23 hours ago) | Filed under code

I have a client who wanted a way of doing lists without all of the coding overhead, and without using the visual editor in WordPress. I immediately thought of Textile, and installed TextileWrapper. It worked great for lists. However, it munged in a spectacular way the rest of the site, riding roughshod over her existing markup.

I tend to give each site that I make a custom WordPress plugin of bits and pieces that come in handy. Filters for text, little functions like time_since() and has_tags(), that sort of thing. To this, I added the following:

require_once( "classTextile.php" );

function textile( $s ) { 
  $textile = new Textile;
  return $textile->fList( $s );
}

function textile_lists( $c ) {
  return preg_replace_callback( "/^[#*]+?.*.(^[^#*])/smU" , "textile" , $c );
}

add_filter( 'the_content' , 'textile_lists' , 6);
add_filter( 'the_excerpt' , 'textile_lists' , 6);
// add_filter( 'comment_text' , 'textile_lists' , 6);

I also uploaded classTextile.php to the plugins directory.

A caveat: it gets a teensy bit wonky when the list is the last thing in the entry and there is no linebreak after the last entry in the list. Just make sure there’s a linebreak after the last list item and everything will be fine.

Native image upload presets

28 June 2008 12:53 PM (3 weeks, 1 day ago) | Filed under code

Changes to wp-admin/includes/media.php

  • Line 443: Remove default image alignment none checked=‘checked’.
  • Line 447: Add default image alignment center checked=‘checked’.
  • Line 458: Remove default image size medium checked=‘checked’.
  • Line 460: Add default image size full checked=‘checked’.
  • Line 540: Remove the default link to original image “ . attribute_escape($file) . “.

Changes to wp-includes/media.php

  • Line 99: Add a dash to the image align class -.

Links for 06 June 2008

06 June 2008 4:08 PM (1 month, 2 weeks ago) | Filed under link
Seasonal ingredient map
An interactive map to find out what produce is in season.
How the web was won
A verbal history of the Internet by the people who made it work.
WordPress honeypot project
Instructions on how to log the values of the $_POST superglobal.

Links for 21 May 2008

21 May 2008 5:02 PM (2 months ago) | Filed under link
Flourish
Actions, brushes, textures, borders and more for Photoshop CS. Retro/vintage leanings.
ComicPress
Free WordPress theme for webcomics.

Links for 01 March 2008

01 March 2008 3:04 PM (4 months, 3 weeks ago) | Filed under link
WP themer kit
Toolkit for WordPress theme creation.

Night owl

21 October 2007 9:03 AM (9 months ago) | Filed under live

Last night I was up in the wee hours moving a client over from Movable Type to Wordpress. Easy peasy. She has 3477 entries and 8534 comments and 29 categories and I absolutely did not want to break her URLs so that meant writing a custom script and doing some .htaccess fiddling as well. In the past I’ve seen WordPress’s import utility hang on mt-import.txt because of the out of memory issue, forget categories, and fail to move over basenames, so I did this in chunks of 500 with PHP and SQL within the same database. (And I’d like to chime in that converting from PST to GMT is boring. And annoying. And I never want to do it again. Unless I’m hired to do it.) I kept the code; doing a plugin with it would not be a bad idea. In my copious spare time. Right.

To do today… Nine o’clock and I already have a list. Dishes, laundry, send the kids outside to play, another WordPress installation, and more tweaks for this one. Busy, busy, busy!

Copyright © 2003-2008.
Entries (RSS) | Comments (RSS).
XHTML 1.0 Strict, CSS, RSS, 508.