Displaying Custom Field Attributes on Frontend in Custom Template File

Home Forums Calendar Products Events Calendar PRO Displaying Custom Field Attributes on Frontend in Custom Template File

Viewing 15 posts - 1 through 15 (of 58 total)
  • Author
    Posts
  • #9686
    Brian
    Participant

    I created a custom field called “homeslider” , and the value for this is a URL to an image file.
    I want to show that image file in a jquery slider on the homepage of my site. I have the slider showing the 3 latest “Events” posts, but the images are not showing up using the normal get custom fields data.

    For these Events Custom Fields, are they being stored in the DB differently than normal custom fields meta data ?

    Please let me know what code needs to be used to pull out custom fields from the events posts.

    Thanks,
    Brian

    #9687
    Brian
    Participant

    sorry, here’s the pastebin link to view the code I’m using the pull the custom fields value (that normally works with standard custom fields on posts , but isn’t working with the way you’re storing events data )

    http://pastebin.com/rMieZWnf

    #9689
    Brian
    Participant

    Ok, I ended up looking through the database to see how these custom field values are stored in ECP 2.0 and found _ecp_custom_1 as the key….

    So for anyone looking for this answer, here’s the code I’m using to pull out the value for my first custom field value in the events custom fields – http://pastebin.com/bhFAZLFM

    #9698

    =)

    Thanks for posting the answer Brian!

    #10414
    Tineke
    Participant

    Hey Brian,

    Would you happen to know how to display a custom field that has a link? (so how do I make it a link?)

    #10415
    Tineke
    Participant

    Woops, found it…. (brain crash)

    <a href="ID, $key, true); ?>” rel=”bookmark”>ID, $key, true); ?>

    #10524
    Reji
    Participant

    Shane,

    This could be more developer friendly if we could pass the field’s label as a sanitized id, instead of the cryptic _ecp_custom_1. Could that be lined up in a future release?

    #10557
    Rob
    Member

    Thanks for the suggestion, Reji. I’m reviewing this with our dev John now and if he thinks it’s worthwhile/easy to do, we’ll work it in for a future 2.x release. Appreciate the suggestion!

    #10787
    John
    Member

    Reji – would something like get_tribe_custom(‘Field label’) be sufficient?

    #10956
    Tineke
    Participant

    Just as an example:

    On my event page I made tabs (event info, location, tickets, links, artists, etc)
    The ticket tab has 6 custom fields separated in two sections:

    Online Tickets
    Label: Field 1
    Label: Field 2
    Label: Field 3

    Instore Tickets:
    Label: Field 4
    Label: Field 5
    Label: Field 6

    I am still trying to figure out how to have the headers empty when there f.e. Field 4, 5, 6 are empty. So, if field 4 is empty, don’t show the Instore Tickets:

    If i do an ‘if’ function now like this:

    <?php $key = tribe_the_custom_fields( '_ecp_custom_1' );
    if ( trim( $key ) == "true" )
    {
    echo 'Online’;}
    }
    ?>

    I get ALL the custom fields again instead of the ones that I choose with:
    <a href="” rel=”bookmark” target=”blank”>
    <a href="” rel=”bookmark” target=”blank”>
    <a href="” rel=”bookmark” target=”blank”>

    Probably doing something wrong but yes get_tribe_custom(‘Field label’) would help us out a lot I guess

    #10974
    Rob
    Member

    Thanks Tineke. Let me run it by John, see if he thinks the get_tribe_custom(“field label”) approach would be worth working into the code base!

    #11026
    Reji
    Participant

    John – yes, get_tribe_custom(‘Field label’) would definitely help.

    #11046
    Rob
    Member

    Looks like this would add value for a lot of folks. Since we’re on a code freeze for 2.0.2, I’m adding it as a 2.0.3 issue. Thanks all!

    #13468
    Janet
    Participant

    Has anyone gotten this, get_tribe_custom(‘Field label’), to work in 2.0.3 …?
    Can you post an example of your code?

    #13531
    Rob
    Member

    Janet: I haven’t heard any reports of it, but let me get Jonah to confirm that it’s functional. Are you having problems getting it going on your end?

Viewing 15 posts - 1 through 15 (of 58 total)
  • The topic ‘Displaying Custom Field Attributes on Frontend in Custom Template File’ is closed to new replies.