Tagsnippets

WordPress: Tag Cloud Based on Author Posts

I’m currently working on a little russian social network powered by WordPress and I kinda got stuck this weekend on the user profile page. WordPress has got a pretty good mechanism for working with users, and the users meta piece is so awesome and useful. I’ve a little problem though, trying to output a tag cloud based on posts that a specific user has written. In general this might...

Customize Posts Order in WordPress via Custom Fields

I came across this last night, might be helpful for some of you ;) Sorting posts in a customized order is pretty simple with the WordPress custom fields mechanism and custom SQL queries. Start off with a basic query: $querystr = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'order' AND wposts.post_type =...

Twitter API: Picking the Right Source

I’m sure you noticed that a few weeks ago Twitter changed the source that came unsigned via the API from web to API which could basically reveal any robot that is trying to act human, right? Well if you look at the statuses/update method in the Twitter API documentation they don’t say anything about the source parameter. Strange, right? Well I read something about it on some forums...

Thickbox and jQuery in WordPress 2.8

The update was great! The new features in WordPress 2.8 are awesome! Most of my Twitter friends have updated to 2.8 and haven’t had a single issue. The new widgets area is so cool! Oh jeez, I’m so excited. For a full features list check out Version 2.8 section in the Codex. Anyway, the only issue I had so far is the Thickbox usage. I’m not sure why it’s lost, but...

WordPress: Twitter Friendly Links Plugin. Stage Two

Missed the beta? No problemo! Just a flashback – the plugin transforms permalinks on your blog into short fancy links within your own domain name: into a short and Twitter friendly similar to what TinyURL does, remember? I’ve updated the plugin a couple of hours ago to version 0.2. The new key features are the “Twitter Stuff” form in your edit post page, with the shortlink...

Javascript in WordPress: 2 Functions 2 Save Your Day

I’ve introduced Javascript mode in the latest update of Quick Flickr Widget (1.2.7) for WordPress, and I just wanted to give you a short advice about handling javascript code in your WordPress plugins. The wp_enqueue_script WordPress function helps you add javascript code to your head section, so you don’t have to mess up with the header.php file. One of the frequently asked questions...

Quick Flickr Widget: Empowered by Thickbox

Finally, version 1.2.4 is public! Can you belive this? I managed to get Thickbox running with the widget! No, it wasn’t that difficult at all. Here are the two tricks: In the plugin init: $options = get_option("pluginname"); if ($options["thickbox"] == "checked") { wp_enqueue_script("thickbox"); add_action("wp_head", "pluginname_thickbox_inject", 10); } And the thickbox inject function:...

Javascript: Element Suicide

A short tip on js suicide. Suicide? Well.. I mean have an element remove itself. I came across this a while ago: a ‘read more’ link which should set the display property of an element to ‘block’ and remove itself completely from the DOM. Plain javascript, no frameworks. Here’s what I came to: this.parentNode.removeChild(this); It doesn’t require an id, name or...

PHP: More on Users

Still working on that User class I wrote about a couple of days ago and yeah, I’ve got some major changes, that increased the class usability and probably flexibility. I posted my thoughts in the comments for that post, and got some positive mail, ICQ and Twitter feedback on those ideas. The original comment said: Alright, I reconsidered the meta data storage concept, cause it’s not always...

PHP: The User Class Snippet

Okay, this is gonna be fun. I just finished my own version of the User class in php. I know there are millions of others around, but I didn’t find one that would suit my project – they’re all too complicated and unflexible. I’ll start off by explaining some of the requirements and a couple of examples. I’ll introduce you to the class at the end. I had to slice the...