get custom field within an array?
-
Hi
I need to display a different URL on a page depending on the value query string in the URL. I’ve set up an array but I want the value returned to be the value of a custom field in a post. so ?id=s returns the custom field value of ‘iphone_app_link_sms’
This is my code but it just returns ‘array’. Can someone please help and suggest a solution?
Many thanks
global $iosurl; $iosurl = array( 'e' => get_post_meta($post->ID, 'iphone_app_link', true), 's' => get_post_meta($post->ID, 'iphone_app_link_sms', true) ); if(array_key_exists($_GET['id'], $iosurl)) { echo $iosurl[$_GET['id']]; exit; }
The topic ‘get custom field within an array?’ is closed to new replies.