CogBlogged Tagged ‘hack’

Put on Your HazMat Suits- Setting Up Metadata For WordPress 3 Custom Content Types

cc licensed flickr photo shared by StayRAW In the previous posts in this series of using the new WordPress 3 Custom Post Types (I keep calling them custom content types, same thing), I overviewed the plans for the MIDEA web site, we set up the places to create the new content types, and diverged into some set up magic using child themes. That was the easy stuff. Now I get into the parts I had to more or less invent on my own (well, with some good leg ups from others)- how to add all of the form field elements to my new content types so I could add extra information to them. This are fields for say, my Organization content types, to have a field to enter their web site address, latitude/longitude for doing some mapping, etc. Now I did this all in custom code, and as hopefully I [...]

WordPress Code Circles

cc licensed flickr photo shared by M.H.ick9s Arrgh, just spent about an hour and half chasing myself in silly code circles. Not that it matters, but just to document my sanity/lack thereof… I have a few WordPress pages hanging off the top banner, and I’d previously had them use PHP code in the pages, using one of the plugins that allow you to put executable PHP in your stuff (yes all warnings apply, you need to know what you are doing, security panic yadda yadda). I think I was using PHP Execution which, like Exec PHP just lets you put the code in the page including all the <?php … ?gt; stuff and let it go. However, I often write posts that have PHp code in them, and I really like using the way the Syntax Highlghiter Plus plugin displays code, e.g. <?php // array of all years data to [...]

Roundabout the WordPress Hackery

cc licensed flickr photo shared by theilr It’s been a while since I did some WordPress hacking, and today I think it showed. Like a good bone I could not let go of a niggling little problem, and then after going around in circles, I found an obvious way that was much more simpler than where I was headed. But there are things even learned in a few trips around the roundabout. Here’s where I drove around in circles today… for a while, I have been publishing web versions of the NMC Horizon Reports in CommentPress format at http://wp.nmc.org — this is very useful for publications since it allows comments to be attached to individual paragraphs, so they are tied at a more micro level to the content. (Yeah they are in the old CommentPress mode, I know I should be using the newer digress.it and am ready to publish [...]

WordPress Shazam! Your Category is Now a Page

cc licensed flickr photo shared by ElDave The main navigation of most WordPress sites is driven by cycling through all of the content that are WordPress pages– which is nice, but sometimes you have content that you don;t want cluttering the navbar. Or maybe you want to insert something that is not a Page into the navbar. I’ve been amazed that so few people seem to know how to subvert it, and below is a little trick I use when I want to wedge some other kind of WordPress content into the navbar by Pages process. Mostly this is in your HEAD… I mean the header.php file of your templates that generates it as an Unordered List: <div id="nav"> <ul>   <li class="<?php if (is_home()) {echo 'page_item current_page_item'; } ?>">     <a href="<?php echo get_settings('home'); ?>/">Home</a></li>   <?php wp_list_pages('title_li' ); ?> </ul> </div> The first li item creates the Home link, and in [...]

Customize Your TwitterTools Prefix Text

Do you use the TwitterTools plugin on your own WordPress site to send your blog posts to your tweet stream? Wanna feel like a real WordPress hack jockey? Here is a little code editing you can do without needing to know diddly squat about PHP. Here’s the thing, when TwitterTools published your new sexy blog post to Twitter, it always prefixes it with the same intro text that everyone else gets: New blog post: Video of My Big Blah Blah Blah Got Stuck in the Blah… http://tinyurl.com/xxxxx Do you really want to post like everyone else? That is so lemming like. Sheep. Conformist. Not for me. Long ago, I dug into the code and found a line to edit to change it, so my blog posts to twitter are always uniquely mine as Just CogDogBlogged: This is so easy, all you need to be able to do is to edit [...]

WP LastPosts: Cause I Keep Forgetting My Own URLs

I just whipped up the puniest of WordPress hacks for the ultimate reasons, to serve myself. If I knew what I was doing, it would be a plugin, but I’ll leave that as an exercise for the reader. Here’s the thing. Whenever I write something, i like to reference by link a previous post. So I have to load my own site to find it, and man, I am tired of waiting. So my hack generates page that just in simple layout lists your latest 100 (or whatever number you wish) posts, so you can either copy the URL or edit it. It makes something like this: The code consists of 2 PHP files and a GIF image that go into your theme directory: http://cogdogblog.com/code/lastposts.zip headless.php is just a simplifed version of header.php with just some CSS in it last.php is a simple template that does all the work images/edit.gif [...]