Home › Forums › Calendar Products › Events Calendar PRO › Displaying Custom Field Attributes on Frontend in Custom Template File
- This topic has 57 replies, 12 voices, and was last updated 11 years, 11 months ago by Jonah.
-
AuthorPosts
-
October 14, 2011 at 8:40 am #9686BrianParticipant
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,
BrianOctober 14, 2011 at 8:42 am #9687BrianParticipantsorry, 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 )
October 14, 2011 at 9:28 am #9689BrianParticipantOk, 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
October 14, 2011 at 11:39 am #9698Shane PearlmanMember=)
Thanks for posting the answer Brian!
November 1, 2011 at 1:00 pm #10414TinekeParticipantHey Brian,
Would you happen to know how to display a custom field that has a link? (so how do I make it a link?)
November 1, 2011 at 1:05 pm #10415TinekeParticipantWoops, found it…. (brain crash)
<a href="ID, $key, true); ?>” rel=”bookmark”>ID, $key, true); ?>
November 3, 2011 at 5:41 am #10524RejiParticipantShane,
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?
November 3, 2011 at 4:31 pm #10557RobMemberThanks 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!
November 9, 2011 at 6:31 am #10787JohnMemberReji – would something like get_tribe_custom(‘Field label’) be sufficient?
November 11, 2011 at 5:16 am #10956TinekeParticipantJust 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 3Instore Tickets:
Label: Field 4
Label: Field 5
Label: Field 6I 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
November 11, 2011 at 10:01 am #10974RobMemberThanks 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!
November 14, 2011 at 3:28 am #11026RejiParticipantJohn – yes, get_tribe_custom(‘Field label’) would definitely help.
November 14, 2011 at 11:03 am #11046RobMemberLooks 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!
January 16, 2012 at 5:46 pm #13468JanetParticipantHas anyone gotten this, get_tribe_custom(‘Field label’), to work in 2.0.3 …?
Can you post an example of your code?January 17, 2012 at 4:46 pm #13531RobMemberJanet: 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?
-
AuthorPosts
- The topic ‘Displaying Custom Field Attributes on Frontend in Custom Template File’ is closed to new replies.