[Resolved] Can you use the Meta Box ID for Elements custom field template tag

Home Forums Support [Resolved] Can you use the Meta Box ID for Elements custom field template tag

Home Forums Support Can you use the Meta Box ID for Elements custom field template tag

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1366414
    Joshua

    I’m using the Meta Box plugin, but for some reason the data in the custom field isn’t displaying on the front end.

    On the Meta Box online generator, I create a test field with an ID of Test_Name. I add the meta box code to my functions.php. Then I go to the test post and add some fake data into the new test field.

    Then, I go to my post header template in Elements, and I change out the title template tag of {{custom_field.Reviews_Title}} to {{custom_field.Test_Name}}. However, when I look at the front end, the data that’s in the Test_Name field isn’t showing up.

    Any suggestions?

    #1366943
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I wonder if they do something with the ID.

    Does this output anything in your functions.php?:

    $custom_field = get_post_meta( get_the_ID(), 'Test_Name', true );
    var_dump($custom_field);
    #1366953
    Joshua

    Hi Tom,

    Thanks for your reply. That didn’t seem to change anything. Honestly, I’m just going to dump using the plugin and stick with the the core custom fields feature.

    I was only using the meta box plugin to better organize my custom fields, but it’s not 100% necessary for what I want to accomplish on the front end.

    Thank you for your help, Tom!

    #1366996
    Joshua

    Actually, I figured it out.

    By default, it adds a Field ID prefix. The default prefix was “prefix-“. This means instead of just entering “Test_Name” into the Elements header, I would have to enter “prefix-Test_Name” to get the data to display on the front end.

    Alternatively, I can just delete the prefix so that just “Test_Name” would work.

    Anyways, figured I’d leave that here just in case anyone finds this in the future and has a similar issue.

    #1367172
    Tom
    Lead Developer
    Lead Developer

    That makes sense – thanks for reporting back! 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.