title: Wordpress php add custom post type meta to each post in list from a plugin
body: <p>I have created a custom post type within wordpress called "product_catalogue" where users can add a product's weekly/monthly rental price.</p>
  
  <p>Now on my page that lists all the posts in that post type (i.e. index.php) I am trying to add those prices. The trouble I am having is that my code only allows the prices to be displayed on the first post in the list, and not on all of them.</p>
  
  <p>Here is my code used to add the prices to the products in the loop:</p>
  
  <pre><code>function add_prices_to_products() {
      global $post;
  
      $price_per_day = get_post_meta($post-&gt;ID, "_per_day", true); 
      $price_per_week = get_post_meta($post-&gt;ID, "_per_week", true); 
      echo '&lt;span class="sl_product_price per_day"&gt;£' . $price_per_day . '/day&lt;/span&gt;';   
      echo '&lt;span class="sl_product_price per_week"&gt;£' . $price_per_week . '/wk&lt;/span&gt;';
  
  }
  
  add_action( 'the_post', 'my_custom_loop_start' );
  
  function my_custom_loop_start( $query )
  {
      add_filter( 'layers_after_list_post_title', 'add_prices_to_products' );
      add_action( 'loop_end', 'my_custom_loop_end' );
  }
  
  function my_custom_loop_end()
  {
  remove_action( 'layers_after_list_post_title', 'add_prices_to_products' );   
  }
  </code></pre>