0

I am using a wordpress plugin to display information about businesses. But I only want few fields to be displayed in a page.

$post_id = the_ID();<br/>
$customContent  = get_post_custom($post_id);<br/>

It returns:

Array (<br/> 
[_yoast_wpseo_google-plus-description] => Array ([0] =>)<br/> 
[_yoast_wpseo_opengraph-description] => Array ([0] =>)<br/> 
[_yoast_wpseo_sitemap-prio] => Array ([0] => -)<br/> 
[_yoast_wpseo_canonical] => Array ([0] =>)<br/> 
[_yoast_wpseo_redirect] => Array ([0] =>)<br/> 
[_yoast_wpseo_sitemap-include] => Array ([0] => -)<br/> 
[_yoast_wpseo_meta-robots-adv] => Array ([0] => none)<br/> 
[_yoast_wpseo_meta-robots-nofollow] => Array ([0] => 0)<br/> 
[_yoast_wpseo_meta-robots-noindex] => Array ([0] => 0)<br/> 
[_yoast_wpseo_metadesc] => Array ([0] =>)<br/> 
[_yoast_wpseo_title] => Array ([0] =>)<br/> 
[bs_sunday_open] => Array ([0] =)<br/> 
[bs_sunday_close] => Array ([0] =>)<br/> 
[detail_active] => Array ([0] => 0)<br/> 
[_yoast_wpseo_focuskw] => Array ([0] =>)<br/> 
[bs_friday_open] => Array ([0] =>)<br/> 
[bs_friday_close] => Array ([0] =>)<br/> 
[bs_saturday_open] => Array ([0] =>)<br/> 
[bs_saturday_close] => Array ([0] =>)<br/> 
[bs_thursday_close] => Array ([0] =>)<br/> 
[bs_tuesday_close] => Array ([0] =>)<br/> 
[bs_tuesday_open] => Array ([0] =>)<br/> 
[bs_monday_close] => Array ([0] =>)<br/> 
[bs_monday_open] => Array ([0] =>)<br/> 
[bs_video] => Array ([0] =>)<br/> 
[bs_yelp] => Array ([0] =>)<br/> 
[bs_twitter] => Array ([0] => twitter/xyz)<br/> 
[bs_facebook] => Array ([0] =>facebook/xyz)<br/> 
[bs_gplus] => Array ([0] =>)<br/> 
[bs_images] => Array ([0] => a:1:{i:0;s:54:\"xxx/yyylogo.png\";})<br/> 
[bs_publisher_review] => Array ([0] =>)<br/> 
[bs_menu] => Array ([0] =>)<br/> 
[bs_website] => Array ([0] => www.xyz.com)<br/> 
[bs_phone] => Array ([0] => 0123 456 7899)<br/> 
[bs_postal] => Array ([0] => A11 111)<br/> 
[bs_state] => Array ([0] =>)<br/> 
[bs_city] => Array ([0] => London)<br/> 
[bs_address_2] => Array ([0] => xyz STREET)<br/> 
[bs_address_1] => Array ([0] => xyz)<br/> 
[bs_phone_number] => Array ([0] =>)<br/> 
[bs_thursday_open] => Array ([0] =>)<br/> 
[bs_wednesday_close] => Array ([0] =>)<br/> 
[bs_wednesday_open] => Array ([0] =>)<br/> 
[bs_twitter_id] => Array ([0] =>)<br/> 
[_yoast_wpseo_linkdex] => Array ([0] => 0)<br/> 
[bs_twitter_hashtag] => Array ([0] =>)<br/> 
[bs_facebook_hashtag] => Array ([0] =>)<br/> 
[bs_update_source] => Array ([0] =>)<br/> 
[bs_facebook_id] => Array ([0] =>)<br/> 
[_edit_last] => Array ([0] => 7)<br/> 
[_edit_lock] => Array ([0] => 1369170429:3)<br/> 
)<br/> 
<br/> 

How to do I print the website (bs_website), twitter(bs_twitter), facebook (bs_facebook)?I tried some of the help in the forum but only "Array" is displayed.

Thanks in advance.

1
  • $customContent["bs_twitter"][0] Commented Jun 19, 2013 at 20:40

1 Answer 1

2

Have you tried this

<?php $meta_values = get_post_meta($post_id, $key, $single); ?>

More info here http://codex.wordpress.org/Function_Reference/get_post_meta

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply. I tried using Pekka's solution which is more relevant to my work. Cheers.
You can use this approach as well though @Steve, especially if you're just looking to get hold of one value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.