Here’s a little tidbit I can NEVER find when I need it: If you need to get all the tags that belong to a current post, here’s the function:
$tags = get_the_tags($post_id);
This will return an associative array of tags, with all their relevant info.
BONUS
If you need the same thing with categories, here’s your function:
[...]
December 15, 2009
Posted by Peter
Read the Full Post
I’m not going to lie: I’m a javascript hack. I dont know what I’m doing half the time, because I don’t have to use it all that often. jQuery is seriously my saving grace when it comes to appearing to know what I’m doing with javascript.
That said, I’m currently working on a project that requires [...]
September 3, 2009
Posted by Peter
Read the Full Post
Occasionally, I’ll run into a situation where I need to call a post specifically using the get_post() function. get_post() returns a Post object, with a number of member variables – the one that stores the actual content of the post being post_content.
However, if you try just echoing $post->post_content, you’ll get completely unformatted text – which [...]
May 21, 2009
Posted by Peter
Read the Full Post
Here’s something that comes up for me pretty often: depending on what I’m trying to do, I sometimes need plugin functions to run (or not run) simply based on which admin page the user is visiting. Here’s the WordPress function that will give you the title of the currently loaded admin page:
get_admin_page_title()
So, if you only [...]
May 16, 2009
Posted by Peter
Read the Full Post
Post meta is easily one of the most useful features in WordPress from a developer’s perspective. Adding custom content to a post provides the ability to accomplish countless goals quickly and easily.
Sometimes, it makes sense to give the user access to a post meta field – for example, if they need to add a thumbnail [...]
May 15, 2009
Posted by Peter
Read the Full Post
In one of many, many strokes of genius, the WordPress core developers threw in a bit of code to allow users (ok, other developers) to define a custom user table, and a custom usermeta table for a WordPress install.
In it’s simplest form, you can point your Wordpress user table at that of another blog on [...]
April 28, 2009
Posted by Peter
Read the Full Post
Here’s a very cool little tidbit I found today (strangely enough, I found it in the bbpress codebase, while working on a bbpress plugin..) Wordpress keeps track of which function/filter combinations are registered, along with which action hooks have been called at any point. If you’re having trouble trying to figure out which action hook [...]
April 17, 2009
Posted by Peter
Read the Full Post
Justin over at justintadlock.com made a post a few days ago about how to preset text in the WordPress post editor. It’s a great post, with an interesting filter detailed. In the comments, somebody mentioned that they’d like to be able to preset custom fields as well – something that seems like it shouldn’t work [...]
April 13, 2009
Posted by Peter
Read the Full Post
This isn’t a terribly difficult task – it’s incredibly common, and it’s covered multiple places in the codex. So why am I writing about it? A few months ago, I was tasked with customizing a plugin – one that someone else wrote. I need to add some options to it, and their [...]
April 9, 2009
Posted by Peter
Read the Full Post
Ralph over at ForTheLose.org wrote up a great post on how to use custom fields in wordpress a few days ago, and I thought I’d expand on it with another feature that I use for clients quite often. Custom fields are a great way to store extra post information, and they can really make for [...]
March 30, 2009
Posted by Peter
Read the Full Post