Blog

If you have come to this page via the theme credit link in the footer of another site, please understand that I am just the author of the Wordpress theme. Please do not contact me about the site you came from, as I am not affiliated with the site in any way.

Tag Archives: WordPress

Twitter Image Host 2

Please email for details about Twitter Image Host 2

Also tagged , | Comments closed

Personalising AddThis’s Tweet Button

AddThis is a quite useful WordPress plugin for adding a host of sharing options to your blog posts.

By default, the “Tweet” button that AddThis provides will append “via @AddThis” to the end of tweets, which seems to me a little uncool, given that it’s your content.

So, here’s a little plugin that lets you specify your own Twitter account name instead of @AddThis.

The principle is simple: AddThis were kind enough to define their own filter for the plugin’s output. The plugin plugs itself into this filter, and makes an adjustment to the Tweet button.

To use it, put addthis-modifier.php into your wp-content/plugins folder, open it up and set your twitter name where indicated. Activate it, and you should be good to go.

Download the plugin: AddThis Modifier Plugin

For extra marks: Here’s some code you can use to replace line 14 (the $twittername = … line) to provide a different Twitter account for each post author. Is that not awesome?:

    $accounts = array('Michael'   => 'MichaelTyson',
                      'Katherine' => 'NellieWindmill');
    $twittername = $accounts[get_the_author()];
Also tagged , , , | Comments closed

Supporting WordPress shortcodes and captions in MarsEdit preview

I noticed that WordPress these days uses a shortcode to define image captions, of the form:

[caption id="" align="aligncenter" width="630" caption="Image title goes here"]<img src="http://domain.com/imgpath/../image.jpg" width="630" height="420" />[/caption]

I’ve recently redone our blog template at Technomadics, and while setting up the new preview template in MarsEdit, thought I’d take a stab at implementing support for captions, too, via some javascript in the template.

I was successful! Here’s how I did it:

Added the following to the “head” section:

<script type="text/javascript">
var prior_content;
function watch_for_changes() {
  var check = function() {
    var elt = document.getElementById('content');
    if ( elt.innerHTML != prior_content ) {
       elt.innerHTML = apply_filters(elt.innerHTML);
	   prior_content = elt.innerHTML;
    }
    setTimeout(check, 100);
  };
  setTimeout(check, 100);
}
 
function apply_shortcode(source, name, callback) {
   return source.replace(new RegExp('\\[' + name + '\\s*([^\\]]*)\\]((.|[\s\n])*?)\\[/' + name + '\\]', 'g'),
                         function(match, paramString, content) {
                           params = new Object();
                           reg = /([a-z]+)="((:?="[^"]+"|[^"])*)"/gi;
                           while ( (match = reg.exec(paramString)) != null ) {
                             params[match[1]] = match[2];
                           }
                           return callback(params, content);
                         });
}
 
function apply_filters(html) {
  html = apply_shortcode(html, "caption", function(args, content) {
     return '<div '+
               'class="wp-caption ' + (typeof(args.align) != 'undefined' ? args.align : '') + '" '+
               'style="width: ' + args.width + 'px;">' + content +
             '<p class="wp-caption-text">' + args.caption + '</p></div>';
  });
 
  return html;
}
</script>

…changed to ‘body’ tag to…

<body onload="watch_for_changes();">

…And wrapped a div around the main “#body#, #extended#” content with an id of content:

<div id="content">
#body#
#extended#
</div>

Basically, it polls the content area for changes, and when triggered, runs it though a filter. The above is extensible, and by adding additional “apply_shortcode” calls from “apply_filters“, more shortcodes can be simulated.

Also tagged , , | Comments closed

Keeping content active with popular posts widget and regular rotation

Vlad Bailescu’s WordPress Stats Helper plugin is useful for showing a list of top blog posts in one’s sidebar, but it can have the tendency to artificially elevate posts in a feedback cycle of awesomeness.

What you want is to rotate the posts around to give other popular posts some exposure. I’ve made some minor adjustments to Vlad’s plugin to add the option for random rotation.

Grab the modified version here: wordpresscom-stats-helper-random.zip

You’ll want to unzip this in your wp-plugins folder, disable the old plugin, then activate this one. See the new settings in the widgets section of your WordPress admin — I recommend a random pool size that’s twice the number of posts to display, but you can tweak the settings to your liking.

Also tagged | Comments closed

Galleria for WordPress

This plugin is based upon the Galleria javascript gallery, and displays your Flickr photos in a slideshow-like gallery.

It also displays your groups and photosets in a clickable list, to display photosets in the gallery.

This is a plugin I wrote for my own use (see it in action here), but I have received several requests to make it available. Read More »

Also tagged | Comments closed

Keeping blog visitors by showing meaningful search results in WordPress

I recently became disgruntled with the way my blogs displayed search results. By default, WordPress blogs will show searched posts exactly as they might appear on an index or archives page: Typically as an extract, or perhaps even as the full entry.

This doesn’t help at all if you’re looking for something in particular – It’s a much better idea to show the post within the context of the search query, as real search engines do.

See it in practice here.

This is a fairly easy thing to actually get working in WordPress. It’ll take just a couple of minutes, and will make a big difference to blog visitors. Here’s how I did it.

Read More »

Also tagged , , | Comments closed

Flickrpress 1.0

Flickrpress sampleI’ve just finished a new release of my Flickr plugin for WordPress, Flickrpress.

The new version features AJAX-based navigation between pages of images, and improved support for insertion within pages and posts as a shortcode.

Flickrpress 1.0 can be downloaded from the WordPress plugin repository

See it an action over on my personal blog.

Also tagged | Comments closed

Upload Janitor WordPress Plugin

This plugin allows you to reclaim disk space and clean up your uploads folder by deleting old uploads you are no longer linking to.

It will identify unused files within your uploads folder, and give you the option of archiving then deleting some or all of these files.

Before any action is taken, Upload Janitor will automatically make a ‘tar’ archive of all files to be erased, including their original paths, so you can restore if necessary. Read More »

Also tagged | Comments closed