https://github.com/vc27/AppendPostData/
The purpose of this class is to append custom field values to the post object. Using this method will lessen the amount of code needed with in "the loop". Rather than writing code with "the loop" you may utilize this class and it's filter to append items to the post object for usage like the following.
// Options Array
$option = array(
'post_type' => array( 'post' ), // Array of post_types
'custom_fields' => array( // array of post_meta fields
array(
'meta_key' => 'some_customfield_name',
'unique' => 1,
),
array(
'meta_key' => 'another_awesome_customfield',
'unique' => 1,
),
),
);
// Helper Function usage
append__post_data( $option );
/**
* $post usage
* You would now have access to the following values with in the post object.
**/
$post->some_customfield_name;
$post->another_awesome_customfield;
// Options Array
$option = array(
'post_type' => array( 'post' ), // Array of post_types
'custom_fields' => array( // array of post_meta fields
array(
'meta_key' => 'some_customfield_name',
'unique' => 1,
),
array(
'meta_key' => 'another_awesome_customfield',
'unique' => 1,
),
),
);
// Class Usage
$AppendPostData = new AppendPostData();
$AppendPostData->init( $options );
/**
* $post usage
* You would now have access to the following values with in the post object.
**/
$post->some_customfield_name;
$post->another_awesome_customfield;