title: Wordpress and custom fields in a loop
body: <p>Say I have custom fields with the keys <code>p_title_1</code> <code>p_value_1</code> <code>p_title_2</code> <code>p_value_2</code></p>
  
  <p>Each of these has values within them and I would like to loop through <code>p_title_[i]</code> and <code>p_value_[i]</code> and show them on the page so that title and value would be grouped together in their own div.</p>
  
  <p>I can't seem to figure out how to write it as a loop to show the 1's together and 2's together.</p>
  
  <p>Reason it needs to be in a loop is incase more custom fields get added in the future. At current I have the following but it only echos the key and value</p>
  
  <pre><code>&lt;?php
                   $custom_fields = get_post_custom( get_the_ID() );
                   $my_custom_field = $custom_fields['p_title_1'];
                   foreach ( $my_custom_field as $key =&gt; $value )
                      echo $key . " =&gt; " . $value . "&lt;br /&gt;";
                   ?&gt;
  </code></pre>
  
  <p>Help is appreciated</p>