tadhg.com
tadhg.com
 

Posts concerning WordPress

WordPress 2.9 Upgrade

15:56 10 Jan 2010

I upgraded this blog to WordPress 2.9 today, and it appeared to go entirely smoothly. Please let me know if you notice any breakage.

Permalink     Comment     [, , , , , ]    

404 Pages

23:36 10 Sep 2009. Updated: 00:38 11 Sep 2009

wpbeginner has a list of their favorite WordPress 404 pages. There are some good ones in there, but none of them do what I think they should do—that is, as well as provide helpful links to popular pages, also provide a list of guesses about where the user was actually trying to go. Coincidentally, today I also read this excellent article about finding the longest common subsequence between two strings. So, at some point, I’ll improve my blog’s 404 page so that it calls, probably via asynchronous request, a Python script that checks the user’s requested URL against all valid URLs WordPress knows about, and then suggests to the user whatever the closest matches are. I’m somewhat surprised that this isn’t done more often, but it seems that far too many sites are really blasé about 404s.

Permalink     Comment     [, , , ]    

Better reST–WordPress Pipeline

23:15 28 Jul 2009

Last week I posted about my setup for going from reStructuredText to WordPress. It involved a shell script, some Python scripts, and the pbpaste and pbcopy commands. It worked, but it was a little on the convoluted side.

Now I have a slightly better process, and one that I will have used to publish this post.
[more...]

Permalink     Comment     [, , , , , , , ]    

Blog Workflow with reStructuredText

22:57 14 Jul 2009. Updated: 23:13 28 Jul 2009

I wrote about moving my writing over to reStructuredText on Sunday, and since then I’ve moved both my morning pages and my blog writing to it. The latter proved more complicated, primarily because I wanted to make the process almost as easy as writing pseudo-HTML (which is more or less WordPress’ native format, and kind of mine, too, for the last several years). With some hacky wrangling, I’ve managed to set that up.
[more...]

Permalink     4 Comments     [, , , , , , , ]    

PyWebSF Site Update

15:46 23 Jun 2009

I did some work on the PyWebSF site, so that it looks rather better than it did with the default WordPress theme. I altered a pretty good WordPress theme called Arras Theme, which I was fairly impressed with. As a reminder, the first meeting is tonight.

Permalink     Comment     [, , , ]    

WordPress 2.8 Upgrade

17:44 14 Jun 2009

Today I upgraded this blog to WordPress 2.8, a relatively smooth process. I ran into completely unrelated problems (hitting the process limit for my shell account) that derailed things for a while, but the WordPress upgrade itself was smooth.

I use Subversion to upgrade, first using
svn export --force http://core.svn.wordpress.org/tags/2.8/ .
in my development environment, seeing if things look okay there, then checking in the 2.8 changes to my own repository (the only niggly part because I neglected to clean the dev environment of changes before the export, so I had to look through things to see what was part of the upgrade), backing up my live database, and then checking the changes out to the live environment. It all looks fine, and hopefully will continue to function normally.

Permalink     Comment     [, , , , , ]    

Fiction Organization

15:04 24 May 2009

I made a WordPress page containing a list of all the fiction I’ve published on this blog. I had to do this by hand, because it appears difficult to get a reasonable list using various WordPress approaches (such as tags). The page I created is hardly a masterpiece of user interface design (I hope to improve it significantly over time), but it’s better than what was there previously.
[more...]

Permalink     1 Comment     [, , , ]    

Bad Behavior Plugin

10:55 07 Apr 2009

The various blog moves and reworkings seemed to reduce the amount of comment spam I was getting, but now it’s gotten out of hand once more, so I’m resuming the use of the Bad Behavior WordPress plugin. Hopefully this isn’t something any legitimate readers or commenters will notice, but if for some reason you find it affecting you, please let me know via email.

Permalink     Comment     [, ]    

WP Plugins: Recent Commentary and Show Tags in RSS

19:38 23 Mar 2009

I finally got around to writing up docs for, and then packaging, the two WordPress plugins I’ve finished recently:

I’m currently looking at support for series in WordPress, and am considering either writing my own plugin or using/forking the Organize Series plugin.

Permalink     Comment     [, , , , , ]    

Some RSS Changes

19:44 19 Mar 2009

I’ve made some changes to my Related Posts by Tags plugin, so that it’s now possible to add the list of related posts to the RSS feed entries. As I was experimenting with this, I realized that I wanted the RSS entries to show the tags for a post as well, so I wrote a (very simple) plugin to do that, too.

As a result, those of you reading this via RSS will now see a list of tags at the end of posts, followed by links to related posts. Please let me know if this doesn’t work as intended, or if you have other comments on the change.

Permalink     5 Comments     [, , , , ]    

New Blog Functionality: Recent Commentary

21:39 23 Feb 2009

I’ve had a Recent Comments section on the front-page sidebar of the site for quite some time, and decided it was time for an upgrade. The old version was straightforward: it displayed a list of the most recent comments and who made them. What I decided I wanted was, rather, a list of the posts with the most recent comments on them, how many comments there were, and a list of the people who made the comments in timestamp order.
[more...]

Permalink     Comment     [, , , , , ]    

My WordPress Development Setup

16:29 13 Feb 2009

One of the first things I did with my resuscitated blog was to figure out how I could develop for it in a reasonable fashion.
[more...]

Permalink     Comment     [, , , , ]    

Twitter Experimentation

18:00 12 Feb 2009

After refusing for quite some time, I’ve decided to give Twitter a try. This might prove short-lived, but we’ll see. I like the concept of easy status updates and of disconnecting them from a larger, clunkier framework, e.g. Facebook.
[more...]

Permalink     4 Comments     [, , , , ]    

Related Posts Plugin and SQL Trickery

11:55 10 Feb 2009
Permalink     4 Comments     [, , , , ]    

New Blog Functionality: Related Posts

23:37 01 Feb 2009. Updated: 16:31 10 Feb 2009

Having revived my proper blog and transferred my content over, I’ve now started adding improvements, some of which I’ve been wanting to add for quite some time. The first one is a list of related posts on the individual post pages.
[more...]

Permalink     Comment     [, , ]    

Blog Move Steps, Part Three: DNS Change

23:58 27 Jan 2009. Updated: 01:13 30 Jan 2009

I’ve wrangled my old plugins and custom code so that it mostly works, except for one or two features (such as “related posts” based on tags) that I’ll revive later. Good enough for now, so I’m making the DNS changes and going ahead.

If you’re seeing this text, you’re on the new server, and all should be well. But if you don’t see another post after this one by about Friday, it suggests RSS problems, so please drop me a line.

Permalink     1 Comment     [, , ]    

Blog Move Steps, Part Two

22:30 26 Jan 2009. Updated: 16:46 28 Jan 2009

I continued working on the blog move today, and most of the tricky database-related steps are done.
[more...]

Permalink     Comment     [, , ]    

Blog Move Steps, Part One

23:53 25 Jan 2009. Updated: 16:46 28 Jan 2009

I spent time today working on moving this blog to a new home, while also combining the articles from the old (real) blog and from this temporary one, and upgrading my version of WordPress in the process.
[more...]

Permalink     Comment     [, , ]    

RSS Borkage

23:58 10 Jul 2008. Updated: 18:14 28 Jan 2009

Apparently, my blog’s RSS feeds were set up incorrectly in the WordPress 2.0 version that I run, and I shouldn’t have been pointing directly to the files in the wp directory, but instead to /wp/feed. With my temporary version running WP 2.5, the functionality of those deprecated links was removed—but they still existed, merely returning blank feeds.

That should be fixed now. The most important article that people might have missed was probably the speech I gave at my father’s funeral, available for those who couldn’t make it in person.

Permalink     Comment     [, , ]    

Simple WordPress Anti-Spam Plugin

23:53 09 Feb 2007. Updated: 02:05 10 Feb 2007

I created a simple anti-spam plugin for WordPress—all it does is reject comments from unregistered users which have more than some number of links in them.
[more...]

Permalink     Comment     [, , ]    

Installing WordPress 2.0

18:06 21 Jan 2006. Updated: 14:16 25 Mar 2006

Steps to installing:

  • Follow the 5-minute installation plan from the docs.
  • Start editing my own theme (start from default).
  • First file: header.php.
  • Second file: index.php.
  • Add UltimateTagWarrior.
  • Enable Permalinks (including enabling mod_rewrite in httpd.conf and turning on AllowOverride All and Options FollowSymLinks in the VirtualHost block, and temporarily making .htaccess world-writable).
  • Enable tag rewrites in UltimateTagWarrior, use commalist for displaying the tags after the articles.
  • Comment out add_filter(‘the_content’, ‘wpautop’); in wp-includes/default-filters.php to stop WordPress from adding its own HTML to my posts
  • Add post_updated plugin to show update time of posts. added this linke to The_Loop: <?php post_updated(‘H:i d M Y’, 0, ‘, <span class=”timestamp”>updated: ‘, ‘</span>’); ?>
  • In progress: Add an archive index following instructions here: http://codex.wordpress.org/Creating_an_Archive_Index
  • In progress: figure out how to link to random “articles” and later to book db
  • In progress: edit single.php to bring it into the current design
    • This included figuring out how to get UTW to display the other posts with the current tags, which wasn’t easy due to my unfamiliarity with OOPHP. Eventually, I instantiated a variable ($currentID) outside of The_Loop, then got its value using $currentID = $post->ID; in The_Loop, and finally $tagset = $utw->GetTagsForPost($currentID); $posts = $utw->GetPostsForTags($tagset); for the array of posts with those tags.
    • I borrowed the following for an initial pass at display:
      if (count($posts)) {
      echo ‘<h2>Listings for ‘ . implode(“, “, $posts) . ‘</h2><ul>’;
      $cnt = 0;
      foreach ($posts as $post) {
      if (++$cnt > 10) break;
      setup_postdata($post);
      echo ‘<li><a href=”‘;
      echo the_permalink();
      echo ‘”>’. $post->post_title.’</a></li>’;
      }
      echo ‘</ul>’;
      }
    • I also set up a different sidebar file, sidebar_single.php, to hold the code for the sidebars on individual pages.
    • In ultimate-tag-warrior-core.php, change part of GetPostsForTags from ORDER BY t.tag ASC to ORDER BY p.post_date DESC
    • Add code to header.php to get category of posts and apply corresponding banner images (category will not be used for searching/navigation, but purely for determining what ‘template’ should be used. Right now, I think that posts should have only one category, but that might change.
  • Enable RSS feeds; add CDATA tags around content for wp-rss.php. This turned into a bigger problem, one that required me to hard-code the UTF-8 encoding into the feed files, because if I allowed require_once() calls before the echo outputting the XML declaration, PHP put a line break in there that caused the feeds not to validate. So I had to move the if (empty($wp)) { require_once(‘wp-config.php’); wp(‘feed=rss’);} stuff below the echo in the initial code block, and remove the get_settings(‘blog_charset’) in header and echo lines, replacing it with hardcoded ‘UTF-8′. Files altered: wp-rss.php, wp-rss2.php, wp-rdf.php, wp-atom.php.
  • Make the RSS 1 excerpt length longer–change <description><![CDATA[<?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'))?>]]></description> to <description><![CDATA[<?php the_content('', 0, '') ?>]]></description> (Note–I haven’t yet tested this in RSS readers, so the rss 0.92 feed might still be broken).
  • Add Markdown for blog entry
  • Add “WP Unformatted” plugin to turn off ’smart quotes’ on a per-post basis, to ensure that e.g. JavaScript bookmarklets come through correctly.
  • TODO: make the ‘read more’ text invisible if the post doesn’t have any more than what is shown
  • To add “summary” support, use a custom field—the_excerpt() isn’t good enough because it’s too tough to conditionally use either the excerpt or something else. The custom field is summary, and the code inside the post div on an index/archive page is:
    <?php
    $postID = $post->ID;
    $summary = get_post_meta( $post->ID, ’summary’, true );

    if ($summary != “”)
    {
    ?>
    <div class=”excerpt”><?php echo($summary); ?><br />
    <a href=”<?php the_permalink(); ?>”><b>[Read article]</b></a>
    </div>

    <?php
    }
    else
    {
    ?>

    <div class=”excerpt”><?php the_content(‘<b>[more...]</b>’) ?></div>
    <?php
    }
    ?>
    <div class=”article_trailer”><a href=”<?php the_permalink(); ?>”>Permalink</a>     <?php comments_popup_link(‘Comment’, ‘1 Comment’, ‘% Comments’); ?>     [<?php UTW_ShowTagsForCurrentPost("commalist") ?>]     <?php edit_post_link(‘Edit’, ”, ”); ?></div>

    Except that this didn’t work on the tag archive page (tag.php), because $post->id simply refused to work there, requiring me to get the post id with: global $id instead.

  • To add “sidenote” support, add the following to single.php:
    <?php
    $sidenote = get_post_meta( $post->ID, ’sidenote’, true );

    if ($sidenote != "")
    {
    ?>
    <div id="sidenote"><?php echo($sidenote); ?></div>

    <?php
    }
    else
    {
    ?>

    <?php
    }
    ?>

    And then add sidenote fields as custom fields when creating posts as necessary.

  • To add support for per-post custom css, add the following to header.php:

    <?php
    $custom_stylesheet = get_post_meta( $post->ID, ‘custom_stylesheet’, true );

    if ($custom_stylesheet != "")
    {
    ?>
    <link rel="stylesheet" href="<?php echo($sidenote); ?>" type="text/css" media="screen" />
    <?php
    }
    else
    {
    ?><?php
    }
    ?>

    And then add custom_stylesheet as a custom field to posts where necessary.

Permalink     1 Comment     [, ]