Skip to content

Instantly share code, notes, and snippets.

@rmccue
Forked from pippinsplugins/gist:4583339
Last active December 11, 2015 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmccue/4584739 to your computer and use it in GitHub Desktop.
Save rmccue/4584739 to your computer and use it in GitHub Desktop.
Code Golf!
<?php
//get the review type based on page custom meta field
function oswc_get_review_meta($postid) {
//try every reasonble conceivable variation that the user my enter to make this as user friendly as possible
$possible = array(
'Review Type',
'review type',
'reviewtype',
'Reviewtype',
'ReviewType',
'Review type',
'review Type',
'Post Type',
'post type',
'review_type',
'Review_Type',
'Review_type',
'review-type',
'Review-Type',
'Review-type',
'post_type',
'Post_Type',
'Post_type',
'post-type',
'Post-Type',
'Post-type',
'Reviews Type',
'reviews type',
'Reviews type',
);
foreach ($possible as $key) {
$value = get_post_meta($postid, $key, $single = true);
if (!empty($value))
break;
}
return $value;
}
@Japh
Copy link

Japh commented Jan 21, 2013

The sad part is, this isn't even a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment