Category: WordPress

Plugin developer, Core contributor and support volunteer. Yeah, I’m a WordPress fan!

  • WordPress function get_the_shortlink

    Many WordPress functions have a standard version which outputs the results directly and an additional version prefixed with get_ that returns the output – useful for adding to a string and manipulating before output.

    One such exclusion is the_shortlink, which returns a short link to any page or post – there is no get_the_shortlink, so many people have to resort to just outputting the result in a FORM field for people to cut & paste.  However, here is a quick way to add the capability to your blog.

    (more…)
  • Integrating MantisBT with WordPress

    Integrating MantisBT with WordPress

    Recently I mentioned how I was integrating MantisBT with my blog. Well, I thought I’d release the code for anybody else to use and tinker with.

    (more…)

  • WordPress Plugin Bug Tracking

    For a while I’ve been wanting to improve the bug (and enhancements) tracking for my WordPress plugins. Right now I rely noting down my ideas and any suggestions that people have made and looking at that whenever I’m working on a plugin.

    Now, though, I’ve installed MantisBT – a free PHP based bug tracking system. I’ve installed it on domain, configured it up and I’m in the process of adding content – my Simple Social Bookmarks is the guinea pig.

    Anyone can view it, but I wanted tighter integration with this site. Plugins exist to do this but they rely on using a SOAP interface – my host doesn’t have this installed, so I can’t use it. Instead I’ve written my own code that directly accesses the MySQL database – and very well it works too. On the bottom of the plugin pages on this site are two new sections – Known Bugs and Planned Enhancements. Under each are listed any entries from the MantisBT database relevant to that category, as well as a link to the roadmap.

    Before you go looking for this, it isn’t yet visible, as it’s part of the site revamp that I’m working on.

    Right now, I don’t intend to release this as a plugin, but if there’s enough interest I may do.

  • Finding the length of WordPress Posts

    I’m just finished converting my plugin pages to use my new WP README Parser plugin. However, I had a nagging feeling that I might have missed, at the very least, 1. But how can I easily tell without going through them all one-by-one?

    Well, their length is a give-away as instead of pages of text, there’s now a single call to my plugin. A quick bit of SQL will show the length of each post and/or page in characters, allowing me to see if any of the original versions still exist.

    Here is an example using standard table naming and will list the details of pages…

    SELECT ID, post_title, guid, length(post_content) AS 'Post Length'
      FROM `wp_posts`
     WHERE post_type = 'page'
       AND post_status <> 'draft'
       AND post_status <> 'trash'
     ORDER BY length(post_content)

    That 3rd line can be modified to WHERE post_type = 'post' for posts, or combined with the original to list both posts and pages.

    Otherwise, it simply lists the ID, title and URL for each page as well as the character length of the page content. It excludes drafts and anything in the trash. The final list is sequenced by the length of the page.

    Not sure if this is useful to anyone, but just in case….!

  • WordPress README files and Markdown

    For those who’ve not come across Markdown, it’s a way of using simple keyboard characters in a text file to indicate formatting. For example **this would be bold**.

    WordPress uses Markdown for the README files that accompanies each plugin – this same file is used to display the plugin details on the WordPress site. Therefore, as a plugin author, I am required to produce Markdown format files.

    At the moment, because I want to have my plugin details on my site as well, I copy and paste the README file to a WordPress post and re-format it. Now, you can change WordPress to use Markdown, but it requires switching off the standard editor as otherwise it will modify the results.

    One of the authors of Markdown, John Gruber, provides conversion scripts in Perl, as well as instructions for modifying WordPress. What I would ideally like, though, is a way to display README files on my site, as required. There is a plugin that will already do this but it does the conversion itself and, well, not very well. The results are iffy to say the least.

    To make matters worse, WordPress’ implementation of Markdown does not match the standard design.

    As with many of my plugins, the need to be able to do something myself has lead me to write a solution. Michel Fortin has converted John Grubers script to work under PHP and, using this as a basis, I am creating a plugin that will display WordPress format README files in a post.

    I’m still working on it, but the principle is that I read in the file and, first, convert the WordPress format to standard Markdown format. From there I can use Michel’s script to do the final conversion. So far, it’s looking good and I’m spending time now adding extra features, such as the ability to miss out README sections (for instance, the installation instuctions) – otherwise, the README is displayed as it is in the actual file. It finds WordPress username and tags and adds automatic links and I’m going to add compatibility with my Simple Content Reveal plugin, so that each section can be collapsed and revealed.

    I’ve already had to speak to Michel about it after having some initial issues, and he’s been very good and helped me out.

    Look out for it in the coming weeks!