WordPress

Posts filed under WordPress

Add Expires Headers in WordPress 

Filed in WordPress Tags: , , , ,
ySlow Suggestion: Add Expires Headers

Add expires headers to minimize load-time for repeat visitors

“Add Expires headers” is a ySlow component that’s missing from most blogs. It’s overlooked because the rules for these expires headers must be buried deep within the bowels of the .htaccess file. Generally speaking, you want to avoid these errors, so most people avoid the .htaccess file. Spelunking in that file is only problematic when you don’t know what you’re doing, though. If you start adding random shit, you’re likely to have a problem.

So, rule #1: Don’t add shit to the .htaccess file if you don’t know what the shit does. Read the rest of this entry »

How to Add eHow Widget to WordPress 

Filed in WordPress Tags: , ,

I was surfing through my Analytics page and discovered some wayward searcher stumbled upon my blog in hopes of finding out how to add the eHow widget to WordPress. What they found was my eHow Widget for WordPress plugin. Mea culpa. This post exists just in case another poor soul happens upon my blog while looking for the same information.

First, grab your eHow Widget code here. You need to be logged in for the link to work. Copy everything in the Widget Embed Code box.

Next, open up your WordPress admin panel and move on over to the Widgets menu*. Drag-and-drop the Text option from the Available Widgets pane to the desired sidebar**. A nice, big text box will pop up.

Fill in the title, if you want to, or skip it.

Paste the code from the eHow website into the open, unnamed text area. Click Save.

Open up your blog to see how it looks. It might be too big for the area. That’s OK! Go back to the Widgets menu. Open up that Text widget. Look at the code in there. The eHow Widget follows this pattern

  • opening tag
  • src=”url”
  • width=”xxx”
  • height=”xxx”

Adjust the width down to the size of your sidebar, in pixels. Unless you know how wide your sidebar is, you’ll need to do this a few times for trial-and-error. Also, adjust the height (again, in pixels) so all the information displays. Just keep double=quotation marks (“”) around the numbers and you’ll be good to go.

* The Widget menu address is usually http://www.yourblogaddress.com/wp-admin/widgets.php

** You need to be using a widget-ready theme. If you aren’t, you can’t use widgets. Most themes are widget-ready.

Widget: Constant-Content Widget 

Filed in WordPress Tags: , ,

This continues on my series of small, one-off widgets to make your life ever-so-slightly easier.

This widget allows you to display your Constant-Content author’s widget in your WordPress sidebar. This one is significantly easier to implement than the eHow Widget. Simply find your Constant-Content referral link (under My Account) and select only the user ID at the very end (?aref=123456). Enter this into the “User ID” box on the widget page, enter your width and click save. Your articles-for-sale widget will appear!

Download the Constant-Content Widget for WordPress

This widget is compatible up to WordPress 3.0.4 and seems to play well with others.

Known bugs: Sometimes, right after install, the widget control will not display (so you can’t edit your user ID). If this happens, click refresh and it should work. This doesn’t appear to be an issue with WP version 3.0.4

Features anticipated for the future: ability to control colors and live preview of widget during editing.

Note: Some users with Linux hosts have reported trouble uploading/unpacking the archive through WordPress’ plug-ins menu. Manually upload the unpacked folder to avoid problems.

Show Link Notes 

Filed in WordPress Tags: , ,

The link Description field in WordPress is limited to 255 characters. If you’re creating a link directory with WordPress or just want to leave a longer description, you should use the Notes field, which can contain significantly more text. Unfortunately, by default, wp_list_bookmarks($args) does not allow for the display of Notes. With a bit of PHP hackery, you can make the template display them.

Open wp-includes/bookmark-template.php in your favorite text editor or IDE. Scroll down to function _walk_bookmarks(), which is, approximately, on line 51. You’ll see an array named $defaults. We want to edit this to include a new default: show or hide Notes. By default, Notes should be hidden, to prevent any kind of template jinkiness with sidebar Blogrolls or link categories found elsewhere. Replace the array with the following

$defaults = array(
	'show_updated' = 0,
	'show_description' = 0,
	'show_images' = 1,
	'show_name' = 0,
	'before' = '<li>',
	'after' = '</li>'
	'between' = '\n',
	'show_rating' = 0,
	'link_before' = '',
	'link_after' = '',
	'show_notes' = 0
);

Now, search for $output .= ‘</a>’;. Directly after this, insert the following

if($bookmark->link_notes != null && $show_notes) {
$output .= "<p>".$bookmark->link_notes."</p>";
}

If the bookmark has a Note, and the page wants the Notes displayed, display them. Once this is in place, open whatever page is displaying your links and, within the $args array, add ‘show_notes’ => 1 at the very end.

Now’s a good time to note that I made some other changes to my wp-includes/bookmark-template.php which I found particularly useful. By default, the code displays the $link_before variable after the a element.

$output .= '<a href="'.$the_link.'"'.$rel.$title.$target.'>';
$output .= $link_before;

I reversed these. It just seems more logical that $link_before would represent something that occurs, well, before the link.

$output .= $link_before;
$output .= '<a href="'.$the_link.'"'.$rel.$title.$target.'>';

Likewise, I reversed the second set, so $link_after actually occurs after the link

$output .= $link_after;
$output .= '</a>';

If you’re not interested in performing PHP hackery, here are a copy of the two files, complete with the edits listed here and a before_notes and after_notes option. Also included is a template for a links page. I make no guarantees that these files will work for you. Back up your existing files first.

Download Display Notes.zip.

Widget: eHow Author Widget 

Filed in WordPress Tags: , ,

Display your 5 featured eHow articles on your WordPress sidebar. This widget requires no editing knowledge to install and use. Simply locate your eHow User ID in the code provided by eHow [see below] and fill out the simple widget form. Once you click save, your eHow Author Widget will be displayed on your WP Sidebar. Control height, width and background colors.

Download eHow Author Widget for WordPress

Current release: 1.2

Corrected typographical errors, added on-screen instructions, updated code to reflect more recent eHow version, added fields to reflect addition of background colors, included on screen color picked (courtesy of JSColor.com).

Known bugs: color picker does not work after widget options are saved unless page is refreshed.

Features anticipated for the future: live preview of the Widget during editing, autolocation of eHow author ID based on user name.

Note: Some users with Linus hosts have reported trouble uploading/unpacking the archive through WordPress’ plug-ins menu. Manually upload the unpacked folder to avoid problems.

Locate your eHow User ID through the eHow Widget code

Your User ID is found after “userId%3D” and before either a double-quotation mark or an ampersand (&).

<embed src=”http://i.ehow.com/images/widget/rss.swf?feed=http%3A//i.ehow.com/WidgetRss.aspx%3FuserId%3D920e69f4-2c7b-4d8b-94f1-63c0376f866b&bgcolor=0xC8CFD7&bgcolor2=0xFFFFFF” width=”300″ height=”450″ allowScriptAccess=”always” type=”application/x-shockwave-flash” /><br><a href=”http://www.ehow.com/videos.html” target=”_blank” >How to Videos</a> & Articles: eHow.com

Plugin: Mass Add Tags 

Filed in WordPress Tags: , ,

Take the tedious labor out of updating multiple posts with the same tag by using the Mass Add Tags plugin. This small, two-file plugin takes up almost no space on your server and creates a single menu item. It’s simple and straight-forward. Enter the tag you want to add, enter the character or phrase that must be in the title for the phrase to be added and click go. You’ll be notified of how many, if any, posts were updated.

Download Mass Add Tags for WordPress.

Current release: 1.2

Corrected typographical errors, streamlined certain portions and updated styling.

Features anticipated for future: add multiple tags at once, search post body, search existing tags, apply tags to all posts in a category.

About Me


I'm Becky. I write this blog. From time to time, someone else will write this blog. I like WordPress, hiking and puppies.

You can hire me for WordPress or PHP odds n' ends on oDesk.