I might be showing my green-ness with PHP code here, but I need help.

I've got divs that are all styled the same but have differing content, as they are related product snippets to be displayed on a product page. I'm trying to allow non-technical editors of the wordpress site that we use to be able to select these related products through use of custom fields.

Is it possible to code these divs in an external file, link that file to the product page template and then call these divs in their entirety using a callback function, which I can manipulate in the template to allow the use of a custom field key?


  • 1
    What have you coded so far to do this? You can add unique divs to different custom fields using custom functions. Commented Feb 9, 2015 at 13:32
  • At this point, I'm just coding these divs directly into the template file, which obviously isn't ideal. Could you give me an example of the unique div/custom field function?
    – Harry Ray
    Commented Feb 9, 2015 at 13:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.