Skip to main content
edited tags
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
Source Link

How to receive all the meta information of a post ?

How can I get all the meta information of a particular post_id, if my meta_key = 'title' and meta_value = 'My Content Template' meta_key = 'download_url' and meta_value = 'http://www.example.com/pdf/pdfinfo.pdf/'

and i have 10 meta key and meta value for the same post. How can i get all the meta information in a tabular format such as:

Title           URL  
My Content     http://www.example.com/pdf/pdfinfo.pdf/
Download Data   http://www.example.com/pdf/phparray.pdf/

I have tried below code:

<table>
<tr>
    <th>Title</th>
    <th>Download URL</th>
</tr>
<?php 
  $stored_titles = get_post_meta( $post->ID, 'title' );
   $stored_urls = get_post_meta( $post->ID, 'download_url');
?>
<tr>
<?php  foreach($stored_titles as $title) { ?>
<td><?php echo $title; ?></td>
<?php  } ?>
<?php  foreach($stored_urls as $url) { ?>
<td><?php echo $url; ?></td>
<?php  } ?>

</tr>

</table>    

Please any one help to get this done.