April 12, 2008

AdRotator Random Ads Plugin

First you should upload the plugin to your wp-content/plugins directory and Activate the plugin from Plugin Manager.

Then you should create one or more files (depending on the number of Ad groups you envision) in wp-content folder with names ending with .txt. For example: banner.txt or skyscrapper.txt etc. Each files contains a specific type of Ads, normally with the same size. If you name the file indicating the type of Ad it displays, then it will be easier for you to remember later.

You can either create them on your desktop and upload them using ftp or create them directly on the server or use the Admin interface, your choice.

Each of these files contains one or more lines. Each line contains the Ad code for any particular advertisement.

What if your ad code is multi-line?
Normally Ad codes are provided in single line. However in certain cases like Google AdSense, for example, multi-line Ad codes are provided. In that case either convert the Ad code to single line manually or just take the most relevant portion of the code at the end and insert it in the file. The remaining code (which normally will be used to setup some parameters) will remain above the location (in your template file) where you would insert the function to select an ad from this ad group. So when this particular ad is chosen, then all the required code will be available and the ad will be visible. Read the AdSense discussion below for further clarification.

This can be used to display Google AdSense, LinkShare or your custom Advertisements.

For AdSense keep the top portion of the code where settings are provided, as-is in your template. Compress the last three lines (includes a javascript file) of the code, which actually inserts the Ad, in a single line and insert it in your text file.

In case you are wondering it doesn’t violate any terms of service regarding competing ads because the final HTML (at that location) displays Ads from only one source, randomly selected.

Finally you need to specify a location to display your ads. Add the code <?php echo getad(’Ad File Name’); ?> (after providing the actual ad file name without the .txt extension) anywhere in your template.

The AdRotator looks for a text file as specified in the Ad file name and with a .txt extension. So if you have a code like:
<?php echo getad(’bannerad’); ?>
Then AdRotator looks for wp-content/bannerad.txt file. If it finds it, it picks up a line randomly from the file and inserts it in your template/html.

You can alter the weight of an Ad (how often you want it displayed) by repeating the same ad line multiple times.

Note: If it cannot find the specified text file or cannot find any ad in the file then it does not insert anything.

March 22, 2008

WP-SNAP Wordpress Glossary Plugin

WP-SNAP! (WordPress System for Navigating Alphabetized Posts) creates an alphabetical listing of post titles on a Category or Page template file. Navigation through the listings WP-SNAP! generates is accomplished using the alphabet itself. (For example, if a site visitor clicked on the letter D, any post titles that began with that letter would be showcased.) WP-SNAP! will work on any Wordpress 2.1.x or higher site, but is particularly useful managing glossaries, indexes, reviews, or directories. Since it is said that a picture is worth a thousand words, here’s a screenshot of WP-SNAP!

March 17, 2008

Batch Categories Wordpress Plugin

This WordPress plugin lets you batch edit your posts: assign multiple posts to a category or delete multiple posts from a category in one fell swoop. Version 1.2 and above also support WordPress 2.3’s in-built tagging system, allowing you to tag and un-tag multiple posts at once.

For example, in this screenshot, you search for books with the “52-in-52 2007″ tag, and you’re about to add the “Books” tag to some of them.

March 16, 2008

Code Markup WordPress plugin

Code Markup is a WordPress plugin that makes it easy to include program code samples in your posts. You can even include HTML markup in the code sample; Code Markup magically knows which characters should be displayed as code and which should be rendered as HTML. For example, with Code Markup you can write:

<pre>
<code>
for (int i = 0; i < top; ++i) {
   vector<int> <span style="color:red">judy</span> = mary();
</code>
</pre>

And have it displayed as

for (int i = 0; i < top; ++i) {
   vector<int> judy = mary();

with “judy” in red, just as you would expect. The <span> tag is rendered as normal HTML , but the <int> and i < top are displayed exactly as typed. This is very useful for times when you want to highlight a particular piece of code in your listing.

Code Markup also prevents WordPress from removing backslashes, turning your quotes into curly quotes, rendering decrements (--) into dashes (–), and so on.

Compatibility

Code Markup has been tested successfully with WordPress versions from 1.5 to 2.1, and should also work with newer versions as they are released.

In WordPress 2 and above, you’re better off disabling the visual editor in order to have finer control over your post formatting. To do this, go to the administration interface. Select Users, then Your Profile. The checkbox is at the top of the screen.

If you do decide to use the WordPress 2 visual editor, Code Markup works with the following limitations:

  • leading whitespace is trimmed within <pre> elements (this is an editor bug)
  • line breaks are mangled within <pre> elements (this is an editor bug)
  • after you have saved the post, the code does not display correctly (even in HTML view)
  • because the display is wrong, you can’t edit code after it has been saved.

Installation

  1. Download the code-markup.php file (see the end of this article for download location)
  2. Copy code-markup.php into your WordPress plugins directory (wp-content/plugins).
  3. Log in to WordPress Admin. Go to the Plugins page and click Activate for Code Markup.
  4. (Optional but recommended) Go to the Options page and click Writing. Make sure “WordPress should correct invalidly nested XHTML automatically” is not checked. (Otherwise it may do funny things to your code listings.)

How to use

The plugin works by escaping most special HTML tags and characters so they display exactly as typed, but allowing certain tags to be rendered as normal HTML. The default set of allowed tags is the standard formatting tags like em, strong, span and so on. You can control this explicitly, or implicitly by specifying the language of the code block. For example, in a normal code block, <em> will be rendered as emphasised text, but in an HTML code block, <em> will be displayed as <em>.

Here’s how to format your code for Code Markup.

  • Enclose all code inside a <code> block.
  • Include any HTML markup you like in the code, for example to add emphasis to certain sections.
  • Separate <code> blocks should be nested within a <pre> block to preserve whitespace.

If you want to fine-tune how Code Markup treats your code, use the markup and lang attributes on the code tag to specify how Code Markup should handle it.

  • <code> or <code markup=”default”> allows common HTML tags to be rendered, and displays everything else exactly as written.
  • <code markup=”none”> displays content exactly as written — no markup is rendered.
  • <code markup=”all”> renders content as HTML — all markup is rendered.
  • <code markup=”em strong a”> treats <em>, <strong> and <a> tags as HTML markup — everything else is displayed exactly as written. You can put whatever tags you like in the markup attribute, separated by spaces. As a special case, you can include the comment tag — this means that HTML comments <!-- like this --> will be “rendered” as normal HTML comments (i.e. not displayed).
  • <code lang=”html”> or
    <code lang=”xhtml”> displays content exactly as written, the same as <code markup=”none”>.

The markup attribute overrides the lang attribute.

Examples

Example: Test strings using <code><b>aString</b> < "foo"</code>.
Display: Test strings using aString < “foo”.

Example:

<pre>
<code lang="xhtml">
   <p> <!-- paragraph -->
	  <b>What's going on?</b>
   </p>
</code>
</pre>

Display:

   <p> <!-- paragraph -->
	  <b>What's going on?</b>
   </p>

Example:

<pre>
<code>
   <p> <!-- paragraph -->
	  <b>What's going on?</b>
   </p>
</code>
</pre>

Display:

   <p> 
	  What’s going on?
   </p>

Example:

<pre>
<code>
for (int i=0; i<5; ++i) {
   <span style="color:red">cout</span> << "smap!" << endl;
}
</code>
</pre>

Display:

for (int i=0; i<5; ++i) {
   cout << "smap!" << endl;
}

Example:

<pre>
<code markup="span">
<a href="<span style="color:green">target-url</span>">Link text</a>
</code>
</pre>

Display:

<a href="target-url">Link text</a>

Bugs

If you want to display the text </code>, <!--more--> or <!--page--> in your code, you have to put them in a <code markup="all"></code> block. If you don’t they will be rendered as HTML, which is not what you want, believe me.

If you find any other problems, please let me know by leaving a comment at the bottom of this page.

Frequently Asked Questions

What is this good for?
The plugin allows you to quickly copy and paste code into your blog, and add HTML markup to it to emphasise certain parts of it. Normally this is not possible without a lot of fiddly manual editing.

What tags are allowed by default?
If the code block has its lang attribute set to html or xhtml, then no markup are allowed: all tags are escaped and will display as typed. Otherwise the following tags are allowed: em strong b i ins del a span as well as <!--comments-->

How do I change the default behaviour?

  • To make the code block render as straight HTML, use <code markup="all">. In this case, make sure that you have typed correct HTML!
  • To make the code block display exactly as typed, use <code markup="none">.
  • To specify which HTML tags should be rendered as HTML, include them in the markup attribute. For example, <code markup="strong em comment">.

Alternatives

There are a few other plugins that do somewhat similar things. Code Markup is simple and useful, but if you feel it’s not quite right for you, you could try looking at these other plugins.

  • Preserve Code Formatting has a slightly more robust untexturizer (it correctly handles a triple dash, for example), but doesn’t allow any markup at all in code blocks.
  • Code Viewer displays code from an external file, so it’s not so good for tiny code snippets. However, it does allow readers to download the code, and it also adds line numbers. But again, no manual markup allowed.
  • Unfancy quote plugin uses the sledgehammer technique to avoid WordPress’s fancification of text: it disables it completely.

There are also a number of syntax highlighting plugins. These make your code look nice, but don’t allow you any manual control of markup. They’re also pretty heavyweight, and some are slightly fiddly to install. But if you want syntax highlighting, try them out.

Please leave a comment if you know of other similar plugins.

Download

You can download code-markup.php or view the source code.

Adsense inline Wordpress Plugin

You’ll need to customize the Adsense code in the plugin itself. Look in the adsense.php file. In the first function there’s a block that says “Begin Google Adsense code”. You want to replace the lines between that line and the one that says “End Google Adsense code” with your actual adsense code provided to you by Google. Otherwise, you’ll be showing ads for me.

Once you activate the plugin, you should notice a new button on your Quicktags toolbar. The new button is “Adsense”, and it works like “more”. Click it to insert the Adsense tag, and enjoy the newfound wealth.

March 15, 2008

WordPress Paged Comments Plugin

WordPress Paged Comments is a plugin for WordPress 1.5 and 2.x to allow comment paging. Useful for those popular blog entries receiving many comments, or a simple guestbook page within WordPress.

Wordpress Brian’s Latest Comments

Brian’s Latest Comments shows the latest activity on the website.

Wordpress Inline Tag Thing

Inline Tag Thing allows you to add and remove tags on posts, inline, using magical AJAX (Asynchronous Javascript And XML) powers.

When you view a post that you are able to edit, a tag edit box will display. Entering a comma separated list of tags in the text box, then clicking the “+” button will add those tags to the post. Clicking the “-” link beside a tag will remove it. The list of Currently Assigned tags list reflects the tags which are assigned to the current post. When tags are added or deleted, this list will update to reflect that change. Tags which are displayed elsewhere for the post will not reflect the changes until you reload the page.

Wordpress Embedded Tag Thing

Embedded Tag Thing allows you to put tags inside your content, wrapped in [tag][/tag] markup; and also allows you to add tags in the content body by including a comma separated list of tags within [tags][/tags] markup.

- Single Tags
To display a word in a post as a tag, wrap it in [tag][/tag] markup (with square brackets!). When you save the post, it will be added as a tag; and when you view the post, the word will show as a link to the corresponding tag page.

So if your [tag]post[/tag] contained this sentence; the word post would show as a tag link the first time, but not the second.

- Multiple Tags
It is also possible to add a list of tags inside a post that get added as tags, but don’t display in the same manner as single tags.

[tags]monkey, banana, disco[/tags] in a post would add the three tags, monkey, banana and disco to the post; but not show up as tag links when you view the post.

Wordpress Tag Managing Thing

Tag Managing Thing allows you to edit your tags.

In the Manage section of wp-admin, there is a Tags menu item. Selecting it will take you to the Tag Managing Thing interface.

It allows selecting the taxonomy to work with. Currently in wordpress there is a category and a post_tag taxonomy. Selecting a taxonomy allows editing the terms within that taxonomy.

Once a term has been selected you can perform the following tasks

  • Change the name and slug of the term
  • Delete a term
  • Split a term into multiple terms
  • Merge other terms into the selected term
  • Change a term to belong in a different taxonomy