Spreadsheet to Table Plugin

This was an extremely quick project to turn spreadsheet data into an XHTML table. The plugin is quite simple to use, just copy some data from a spreadsheet ( or the visible part of an XHTML table) and paste it into a blog post between the tags [table] and [/table] (make sure that columns are tab separated and rows are on their own line). This is a no frills plugin. The first row is used as the column names and is added to a thead tag. Anything can be added to the [table] tag after “table” and it will become the table’s caption. EX [table "This is an example table"]

So this:

[table "This is an example table"]
gf	sfg	sfcx	dfg
asd	sd	dsfs	
xcv	fds		sgdf
dfg		dfg	dfg
	dfg	dfg	dfg
[/table]

Becomes:

“This is an example table”
gf sfg sfcx dfg
asd sd dsfs
xcv fds sgdf
dfg dfg dfg
dfg dfg dfg

Installation:

  1. Copy and Paste the contents of the texbox below into a .php file.
  2. Upload and activate.

< ?php
/*
Plugin Name: Tabeler
Plugin URI:  http://anthologyoi.com/plugins/
Description: This plugin allows you to copy data directly from a spreadsheet and paste it into your blog, and will automatically create a table for it.

Continue reading. »

WordPress Character Map and Unicode Encoder

WordPress Character Map and Unicode Encoder is a simple to use plugin that adds a character map underneath of your edit post box which provides easy access to all unicode entities. It also allows you to convert all special Unicode characters (anything you wouldn’t see on the average American keyboard) to their respective entities and back again. (This feature can also be downloaded as a separate plugin.) The character map supports all Unicode characters (a few sets have been disabled because of their size) and allows you to set your “favorite” characters which will automatically be displayed underneath the edit box.

The most powerful part of this plugin is the Unicode converter. I was able to go back to one of my older posts that had many Japanese and Chinese characters and convert the entire post to valid Unicode in one click. Go view the post and try switching Character encodings in your browser. Nothing changes if you do.

Continue reading. »

Improvements for Stattraq plugin.

Ever since I originally started using Stattraq a few things bothered me about the way it worked. Here are the fixes to a few of them.

Include pages with posts in your stats.

  1. Open stattraq.php
  2. Find:
    global $doing_rss, $p
    Replace With:
    global $doing_rss, $p, $page_id, $pagename,
  3. Find:
    if (($p != '')){
    	$p = intval($p);
    	$article_id = $p;
    }

    Replace with:
    if (($p != '')){
    	$p = intval($p);
    	$article_id = $p;
    }elseif (($page_id != '')){
    	$page_id = intval($page_id);
    	$article_id = $page_id;
    }elseif (($pagename != '')){
     $reqpage = get_page_by_path($pagename);
    	if ( !empty($reqpage) )
    		$article_id = $reqpage->ID;
    }

To add a list of all Pages that link to your site grouped by Website (excluding Google):
Open “wp-stattraq/reporter/summary.php”

Find:

< ?php echo PrintTimestamp();?>
			
			<div id="queryTerms">
</div>

Before Add:
<table id="referrersTable">
					<thead>
						<tr>
							<th>#</th>
							<th>Referrer</th>
							<th>Pages</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<th>#</th>
							<th>Referrer</th>
							<th>Pages</th>
						</tr>
					</tfoot>		
					<tbody>
< ?php
if($results){
	$i=0;
	foreach($results as $row){
		preg_match('/(http.*?\:\/\/.*?)(\/.*)/', htmlentities($row->ref), $matches);
		$ref_array[$matches[1]][] = $matches[2];
	}

				
	while( list($site, $pages) = @each($ref_array) ){
		if(strpos($site,'google') ==false && $site != ''){?>

			<tr class="<?php echo ($i % 2 == 0 ? 'even' : 'odd' );?>"><td>< ?php echo ++$i;?></td>
			<td>
			<a href="<?php echo $site;?>">< ?php echo substr($site,0,50);?></a></td>
			<td class="right">

		< ?php foreach($pages as $page){?>

			<a href="<?php echo $site.$page;?>">< ?php echo substr($page,0,50);?></a><br />

		< ?php}?>


		</td>
		</tr>
< ?php 	}
	}
}?>
					</tbody>
				</table>

WordPress How To: Easily make an admin panel for a plugin

I find the Admin panel the most tedious part of plugin development–even the slightest changes to the plugin requires major changes to the Admin panel, and it can be hard to remember every option you have in your plugin. However by following a few simple rules, your next Admin panel will be a breeze. Once you have the basic parts down, new options are just a cut and past away. One thing to note is that his Admin panel uses a few features that are best if repeated inside your plugin itself.

Please note that these same general techniques work outside of WordPress also; the only thing that you would need to do is to change the way options are actually set. Also, I assume you already know HTML; this is not a basic HTML tutorial, but rather is a way to do a specific task.

Continue reading. »

WordPress Access Keys Plugin

The WordPress Access Keys Plugin a allows you to add access keys to pages and categories to improve accessibility of your WordPress website. This works with any page or category list that is called with wp_list pages and wp_list_categories respectively. This plugin works in all WordPRess versions from 2.1 – 2.5.

Screenshot of Admin Panel:
Screenshot of Access Keys Version 0.1

Demo:
The About page on this site has an access key of 6 and the site map has an access key of 3.

Download:
Access Keys version 1.0

Installation:

  1. Download the zip file, unzip it and upload to your wp-content/plugins folder
  2. Upload to your plugin directory.
  3. Activate.
  4. Go to the Admin Menu under Manage named Access Keys.
  5. Read the instructions.

Use:
Use of this plugin is simple. On the Admin panel it lists pages and categories with a current access key, and in a separate list it lists the pages and categories without access keys. Just add an access key just type an access key in a text box and then click the save button.

Continue reading. »

A few WordPress Tricks.

Just a few little tips for WordPress:

If you don’t want the titles of posts to have the » character before them for SEO purposes just use:
< ?php echo trim(wp_title('&amp;raquo;',false), '&amp;raquo; ');?>

I was sick of my index.php being used to display pages, so I added the following to the top of my index.php to force WordPress to use single.php for all pages:

< ?php
if(is_page()){
include('single.php');
exit;
}
?>

I wanted to be able to use javascript in some of my pages so I added the following to my header.php:

< ?php
if(is_page()){
$j = get_post_meta($post->ID, 'header', true);
	if($j != ''){
		echo $j;
	}

}
?>

Now anytime I need special style or javascript code added for a particular page I just add a custom field with the name header.

Have you ever tried to validate your WordPress site to use with Google Webmaster Tools? It can be a pain depending on the way your permalinks are, and even if those don’t cause a problem when Google tries to go to a random URL if the header isn’t 404 then it fails.

Continue reading. »