I’ve not had nearly the desired time to monkey around in WordPress (hence the near stock template), but I am hoping over the more slow time of summer to slowly add and tinker and perhaps break. I am still trying to get my mind around the template/tag structure, which is fairly sensible.
What I’d really like is an ability to use PHP code in posts and templates, and I feel it is possible (I played this morning with the RunPHP plugin which seems more suitable for
echo() type commands, where I prefer more code leverage.
My project was to convert the old “Where’s Alan” page that uses the slick IndyJuniour Flash mapper, XML in a complete PHP template I wrote in MovableType. I have a menu that allows me to pass a year as a script parameter, and thus pull up the XML file associated with that year.
I tried first creating it as a WP Page, but it never executed the PHP and I think there are issues with how parameters are passed to WP (everything actually funnels through the barebones index.php file). I threw my hands up in the air and just took the basic single entry layout created it as a new *.php file in my main blog directory, and we are fairly good to go as a direct URL:
Then I tried to get fancy and find away to re-direct it as a WP page, so eventually it can be integrated into what should expand as a side bar navigation scheme. What I was able to see by having my page merely use PHP to echo the
$SERVER['QUERY_STRING'] is that I could detect this page by a value of
pagename=indyjunior, which is what is passed when you click on a page link. So I then hacked the opening of the
wp-blog-header.php page to sniff first for this value, and divert from there:
// alan's hack for trapping my special pages
if ($_GET['pagename'] == 'indyjunior') header('Location:/cdb/indy.php');
All it means is that a link to:
silently bops you to the real page:
I am sure there is a more elegant way about this, but this is all part of the learning cliff.