Custom Fields Made Easy

Posted by admin in LinkyLoo, themes, Co... | 10.13.2008 - 5:09 am

Nathan Rice who is a prominent theme author within the WordPress community has published an article that explains an easy way to retrieve the contents of a custom field. Instead of doing things the conventional way, Nathan explains how to simply use a function in order to call the contents of the custom field into a theme. This article should be especially useful to theme authors out there who are looking at providing custom field functionality into their work.
Design Trendsinspiration

Original post by Jeff Chandler

    Technorati Tags:


    How to Only Retrieve Posts With Custom Fields

    Posted by admin in LinkyLoo, themes, Co... | 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: