Could someone please help me with the get_post_meta() function? I read the manual but it’s a little meager when it comes to PHP functions and my OOP knowledge is not good enough (yet).
I’d like to fetch data from the custom fields for every post using get_post_meta($post->ID, $key, $single); and save each value into a variable. Eventually i want to echo the data on certain places depending on the content.
I tried several things but i always get empty echo/print_r. The solution is probably very easy but i can’t seem to find it.
I can rewrite this function in PHP using a new MySQL-connection, but i prefer to use the standard functions and connections instead so the site stays fast.
In this case I had two meta data values with the key port_links assigned to my post. I assigned this array to the variable $links. To display the values of an array you can call them by there placement in the array using , , …etc.
Viewing 1 replies (of 1 total)
The topic ‘Store metadata in variables or an array’ is closed to new replies.