How to Only Retrieve Posts With Custom Fields

Posted by admin in WordPress, HOW-TO, W... | 04.14.2008 - 6:00 am

One question I come across a lot regarding custom fields is how to only retrieve posts based on a custom field.
For example, if a post has a custom field of “MyData”, someone might want to only retrieve that particular post.
The WordPress Codex has a technique for retrieving posts based on custom fields, which consists of writing your own query and going through the results.
The technique in the Codex is good, but I’ve found a re-usable way one can retrieve only posts with certain custom fields.
The technique I use makes use of two custom functions placed in a theme’s “functions.php” and a custom WordPress Loop.
Let’s get started — The “functions.php” file
First, let’s place the two custom functions in the “functions.php” file. This file should be in your theme directory, but if it isn’t there, you can create one using any text editor.
Here are the two functions below:

function get_custom_field_posts_join($join) {
global $wpdb, […]

Original post by Ronald Huereca

    Technorati Tags:


    Vulnerable WordPress Blogs Not Being Indexed

    Posted by admin in WordPress, HOW-TO, W... | 04.08.2008 - 10:26 pm

    Vulnerable WordPress Blogs Not Being Indexed: Technorati has decided to not index vulnerable and exploited WordPress blogs. This comes after the recent spat of hacks that were discovered on various high profile blogs and websites. What was even more interesting was the fact that some of these hacks and exploitations might have come from covert and encrypted code hidden in various themes available for free over the web. The moral of this story is that you need to upgrade your WordPress blog now to WordPress 2.5.
    Just so that everyone is aware, WordPress 2.5 is the latest stable version and this should be the version that everyone should upgrade to. Any older versions leaves you vulnerable. As for themes, if you feel that the theme you are using might be suspect of something strange, just disable it and get something else. I suggest you download themes from the original author’s website/blog […]

    Original post by Mark Ghosh

      Technorati Tags: