Tag Archives: code


wordpress 2.2 is out. Easy upgrading is still a ways off. unless you’re me, and you’ve moved to SVN. then it’s just svn switch http://svn.automattic.com/wordpress/branches/2.2/ 😀

the latest undocumented features include atom API support. all that coding in app.php does little good if you don’t reference it. going off of what my wordpress.com blog looks like, you should add this to the head of your blog:

<link rel="introspection" type="application/atomserv+xml" title="Atom API" href="<?php bloginfo('url') ?>/app.php" />

you can implement that as a plugin, or in your theme. i’d love to see XML support moved to the core, but that might just be me.


for the obsessive theme switchers

I’m prepetually unsatisfied by themes. it’s not the theme authors’ fault, i’m just restless. alex king pointed to more advice: From Install to Pimped Out that sounds like the advice i found when i started using wordpress. but for anyone who does, or might, change themes, it’s wrong.

when you’re talking about meta tags, or feedburner RSS feeds, or custom title tags, you’re talking about things you don’t want to break when you change themes. and there’s no reason for them to. this is how i do it: i wrote a plugin.

Gasp! Shock! horror!
not really. if you can handle everything in the post above, you can handle this plugin. here’s how it starts:

Plugin Name: archGFX Functions
Plugin URI: http://archgfx.net/
Description: all the things that i hack into themes, now they have their own file
Version: 1.0
Author: SunBurntKamel
Author URI: http://archgfx.net/

you need to have a name, the rest of it’s optional.

so, all that fun stuff that you want to add to the head of your blog? dump it into a function:

function archGFX_head() { ?>
<META NAME="Description" CONTENT="archGFX is the brand name used by Adam Freetly. This portfolio represents personal and collaborative work." />
<meta name="keywords" content="adam freetly, architecture, blog, portfolio, design, rendering" />
<META NAME="geo.position" CONTENT="41.92;-87.70" />
<META name="geo.region" content="US-IL" />
<META name="geo.placename" content="chicago" />
<link rel="shortcut icon" href="http://www.archgfx.net/images/blogrdfbg.jpg" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://feeds.feedburner.com/archGFX" />
<link rel="search" href="http://archgfx.net/opensearchdescription.xml" type="application/opensearchdescription+xml" title="archGFX" />
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
<script type="text/javascript">
_uacct = "UA-91088-3";
<?php }

obviously i have a few more things than average. google analytics scripts, geo tags, favicon, etc. you can call the function whatever you want, just remember it. now that we’ve got all our code, we need to insert it:

add_action('wp_head', 'archGFX_head');

that’s it, save the file, activate your ‘plugin’, and you’re good to go. naturally, i do a few more things with this. i also handle my footer copyright notice the same way, with

add_action('wp_footer', 'archGFX_foot');

i add the mybloglog widget to my dashboard with
add_action('activity_box_end', 'archGFX_MBL');

and, i don’t have to worry about forgetting to add any of it next time i switch themes.  the only thing that i don’t put in the plugin is my title tags.  you can only have one of those.  so while i could add mine with a plugin, i’d have to delete the theme’s title manually.

Defective Themes: Duplicate Content

Talking to Rob about his nifty architecture blog search engine, I realized just how important things like the Duplicate Content Cure Plugin are. Not just for fear of being kicked out of google, but because it makes your search results real. By default, your monthly, category, tag, and author pages (if they exist) show up, and force your relevant blog posts ‘below the fold’. Worse still, old articles won’t show up on category pages, despite being the reason a person landed on your blog. That’s exactly what happens with a search engine that searches only blogs, without using google’s blogsearch: pages and pages of archives, before you get to actual posts.

So, the plugin is nice, but you can also do it in themes, just add:

 <?php if ( is_category() || is_archive() || is_search() || is_author() ) { ?>

    <meta name="robots" content="noindex,follow"><?php

} ?>

<?php if (function_exists('is_tag')) { if ( is_tag() ) { ?>

    <meta name="robots" content="noindex,follow">

<?php } } ?>

to header.php. The UTW stuff (is_tag()) is a little annoying, but other than that, it’s boilerplate.

Official Theme Options, Please

Noscope | Hey WordPress Team: How About Theme Options, Officially Supported?

sure, theundersigned’s tutorial, and ozh’s themetoolkit are better than a kick in the head. but with custom headers, sidebar widgets, and color pickers being available to theme authors via API, why can’t we have an official options page API? one that sanitizes values, does error checking, all that good stuff that the theme toolkit gets blasted for not doing?

this is the sort of thing i’ve been asking for, and i’m glad i’m not alone.

Just Like a Real Coder

Version Notification

In my attempts to not be one of those idiots, i’ve not only updated disconnected to include a version update notification script, i’ve also created a project for it on sourceforge. i know all the cool themes use google code, but google has been untrustworthy lately. I guess the idea of not doing evil goes out the window when you become a monopoly. i know that OSTG is a corporation, just as capable of evil as google, but i still think it’s less likely, given the free-beer-fundamentalist nature of their clients/advertisers/users.

sourceforge is pretty cool. i’ve got my own little SVN setup although i have yet to figure out how to let people who are not developers just download it.:


I can also link to the viewable files, like my functions.php, so i can show you how i hacked up ceejayoz’ little tutorial, to make my own function, and then add it to the activity box.
I also haven’t figured out how to build a webpage for the project.

i did all of the coding for the new version in microsoft’s visual web developer (speaking of monopolies), which is incredibly useful. well, more useful for CSS, since it groups all my code in elements, classes, and ID’s, which is far better than dreamweaver. it doesn’t have a PHP template though, which is annoying. the javascript template does well enough, tho. Dreamweaver, for whatever reason takes an obnoxiously long time to load on my computer, where VWD loads nearly as fast as notepad. It has all the useful features of dreamweaver (syntax highlighting, auto-closing tags, auto-completion, etc), just without the bloat. I’ve also started relying more on firebug than on the web developer extension for firefox. it’s all about the right click > inspect element:

Firebug - Web Development Evolved

Akismet Excerpts

Engtech and I thought this was an excellent suggestion for dealing with the torrents of spam in the akismet panel, but matt disagrees. Engtech wrote a Greasemonkey Script that implements it browser side. I, being afraid of browser bloat, and wanting this for archGFX, not for this wordpress.com blog, hacked it in /wp-admin/wp-admin.css. It’s a hack so simple, i’m embarassed i didn’t think of it sooner:

#spam-list li {
max-height: 6.5em;
overflow: hidden;
margin-bottom: .5em;

#spam-list li * {
display: inline;

added to the end of the file. (i actually appended it to tiger.css, which works the same.) this is what it looks like:

auntie spam

if that’s not enough context for you, or if it’s more than you need, you can adjust max-height to your liking. if you’re using IE6 or below to review your spam, you’ll want to specify height instead of max-height.

social bookmarks on wordpress.com

This is an addendum to raincoaster‘s operation global media domination. I never saw the value in these, since i already have my own del.icio.us button in my browser. but she says they drive 10% of her traffic, so I guess I’m not most people. Here are the icons for the various social bookmarking sites:

Blinkslist :: del.icio.us :: digg :: furl :: ma.gnolia :: newsvine :: reddit :: tailrank :: Simpy :: fark :: Stumble It!

they’re all hosted on wordpress.com, so you can use them ‘as-is’ if your blog is hosted on wordpress.com. if you’re running wordpress on your own host, I highly recommend alex king’s share this plugin, or the sociable plugin. (in fact, i grabbed the icons from these plugins). If you’re not running wordpress, you must not be cool, and therefore, I cannot help you. 😉

First thing, you’ll want to grab the code. it’s in this text file:
Social Bookmarking Template

Next, publish your post. Then open up the template in a text editor (Notepad on windows, textedit on mac). You’ll want to go to Edit > Replace (or Find and Replace), and replace any instances of xURIx with the address of your post (this is why you had to publish it first).

Find and Replace

Now do the same thing, and replace xTITLEx with the title of your post. You’ll want to put + signs in place of spaces, though (e.g. social+bookmarks+on+wordpress.com) so that the links work. After that, select everything and copy it.

Now go back to your post and edit it. if you’re using the rich text editor, you’ll need to switch over to the (scary) code tab. paste all this at the end of your post.

Bookmark This:

add to del.icio.us :: Add to Blinkslist :: add to furl :: add to ma.gnolia :: Stumble It! :: add to simpy :: seed the vine :: :: :: TailRank