如何使用wordpress中的类型插件在帖子中显示自定义字段

I am presently using types plug-in to display the event list, I am able to add the custom fields for admin to enter date and location, but I am unable to display the custom fields along with the posts in the site, please tell me the solution.

I tried with the following code, but no use,

$key="wpcf-date"; echo get_post_meta(4, $key, true);


$querystr = "SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta";

$pageposts = $wpdb->get_results($querystr, OBJECT);

echo $pageposts;

Within the Loop, just do :

$wpcfdate = get_post_meta( get_the_ID(),'wpcf-date', true );
echo $wpcfdate;

On the page where you are doing the code did you defined wpdb as below..

global $wpdb;

Try to echo the ID above the 2 lines given by RafH so that you will know whether ID is coming or not.

echo get_the_ID();