PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to use a merge tag within the custom_field merge tag

  1. Took me all day to figure this out, so i thought i would share the code.
    http://pastebin.com/bKrNJeda add this code to your functions.php

    Obviously you might want to do a find and replace on the term "unit_price" and give the custom merge tag your own name, depending on application.

    Then assuming you wanted to do this: {custom_field:{pizza:7}}
    You would write it out like so: {unit_price:pizza_7}

    Why would you want to use this? say your user choose a type of product from a drop down list and you want to hit them back with more information about the product they chose. You would create a lookup table of all the possible products as custom_fields on the post this is attached to, and then implement the above code.

    Hopefully this helps someone.

    -deweydb

    Posted 12 years ago on Friday February 3, 2012 | Permalink
  2. Thanks for sharing Dewey. :)

    Posted 12 years ago on Friday February 10, 2012 | Permalink