Don’t complicate it with output filters: just print the text you want in a link and style it to look like a button. It’s just a CSS question.
<a href="<?php print_custom_field('xxxx:raw'); ?>" class="looks_like_button" >
Thanks a lot it works a treat! one other thing i was wondering i included a date custom field and i was wondering how to use that to arrange posts? I have a page that pulls in all the “shows” post types and shows the featured image but it orders them by the date they were added it would be cool to have them in order of when the shows are taking place if you know what i mean.
Anyway thanks for getting back to me and well done with the plugin its awesome.
If you want to use a date field to sort by, then it’s imperative that you store your data in a good format. I always store dates in the MySQL format: YYYY-MM-DD HH:MM:SS
That means that everything sorts correctly because a year is greater than a month is greater than a day etc. If you want to format that date differently for your users, then fine: use PHP’s date functions to modify it when you print it. I built a lot of convenience stuff into GetPostsQuery, so you could do something like this in your theme file
require_once(CCTM_PATH.'/includes/GetPostsQuery.php'); // if necessary
$Q = new GetPostsQuery();
$args = array();
$args['post_type'] = 'my_events'; // for example
$args['orderby'] = 'event_date'; // or any reg. or custom field
$args['date_format'] = 2; // or any valid date format.
// Shortcuts for the date_format function:
// 1 = 'F j, Y, g:i a' March 10, 2011, 5:16 pm
// 2 = 'j F, Y' 10 March, 2011
// 3 = 'l F jS, Y' Thursday March 10th, 2011
// 4 = 'n/j/y' 3/30/11
// 5 = 'n/j/Y' 3/30/2011
$results = $Q->get_posts($args);
// print each result out the way you want, as list items, paragraphs etc.
// etc.
See the following wiki pages for examples:
http://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts_examples
http://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts#date_format
Thanks again for getting back to me so quick. I couldn’t get what you suggested to work so i did this and it seems to do the job
$args = array(
‘meta_key’ => ‘show_date’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘ASC’,
‘post_type’ => ‘shows’,
‘posts_per_page’ => -1 );
$loop = new WP_Query( $args );
Cheers Andy,
There are lots of examples for how to use GetPostsQuery on the wiki, and it’s more thorough without the inane caveats of global variables and other WP nonsense, but if WP_Query works for you, go with it.