Home › Forums › Calendar Products › Events Calendar PRO › Change labels for the additional fields
- This topic has 8 replies, 2 voices, and was last updated 12 years, 9 months ago by
Barry.
-
AuthorPosts
-
July 3, 2013 at 3:58 pm #53096
Chris
ParticipantHello, I’m digging the 3.0 update. I’m trying to find my way around the tailoring and where to find the files that do what other files used to do. Previously the files in this screenshot (http://cl.ly/image/2H350G240s3B ) handled what I’m trying to achieve, but I don’t know what the comparable files in 3.0 are.
I’m trying to create a label for the additional fields (URL) so I instead of displaying the entire URL, I can put a word or phrase, and I’m trying to change the name of the OTHER category (hopefully they’re in the same file). Here’s an example: http://cl.ly/image/1s0B46152L3b
Can you all help me out?
July 4, 2013 at 8:39 am #53236Barry
MemberHi Chris,
Here are two good resources to get a feel for where templates are (and how they work) in the current release:
* Themer’s Guide at https://theeventscalendar.com/support/documentation/events-calendar-themers-guide/
* A video overview by our developer Jessica https://theeventscalendar.com/the-events-calendar-3-0-preview-talking-templates-with-jessica/So there are actually a number of different approaches you might take, perhaps the simplest though is to add a short piece of code to your theme’s functions.php file, a bit like this:
You would of course need to tweak it so it catches whichever custom fields you are interested in modifying, as that’s a fairly generic example.
It could indeed be used to similar effect on various bits of event meta data, not just custom (/additional) fields.
July 4, 2013 at 10:59 am #53299Chris
ParticipantThanks for the feedback Barry. This is pretty close to what I needed. The bit that was missing was adding a URL. I modified your code to change the label to an active URL. http://pastebin.com/tkwTRpFB
July 4, 2013 at 11:48 am #53319Chris
ParticipantWell, almost. The addition works for relabeling one label, but does not work when the if and return portions are repeated for other labels (mostly because I don’t know PHP and I’m pretty sure I’m doing it incorrectly). My guess is that the function looks to resolve the first if statement and once it does, the other if statements are not considered. http://pastebin.com/8755SiKC
July 4, 2013 at 12:21 pm #53325Chris
ParticipantWell, I see that I need to create a new function for each label. That part is solved.
I did, however, overlook the URL that was being generated as it is not linking correctly. I want to use the URL value of the additional field so that the value of the field becomes replacement words
July 4, 2013 at 12:48 pm #53327Barry
MemberIt looks like you are using the label within the href attribute whereas – based on what you are saying – you probably want the value, which is contained within $meta. Note also that you should quote the value of the href attribute:
Bad: <a href=url> Link text </a>
Better: <a href=”url”> Link text </a>You can certainly roll this up in a single function, I was really just giving you a starting point to work out from – but you might be interested in if/else or switch blocks here.
July 4, 2013 at 1:11 pm #53331Chris
ParticipantThanks Barry. I’ll have a look at the if/else and switch blocks.
There’s something that must be staring at me in the face with the code. I’ve replaced the href with “$meta” and the end result is the event url/$meta
I’ll keep looking. If you can help, great.
July 5, 2013 at 7:53 am #53429Chris
ParticipantBarry, your snipped modified to http://pastebin.com/tLTYN60r only works when the additional field type is set to TEXT. When the field type is URL it doesn’t work.
Perhaps a feature request is to add a field to the field type URL on the event page admin view that would allow users to add a different label. If blank, the URL appears. If text is entered, the URL is displayed as text.
Just a thought. And thanks for helping me out.
July 9, 2013 at 8:04 am #54006Barry
MemberNo problem – and definitely feel free to use our UserVoice page if you want to post this or any other feature requests:
-
AuthorPosts
- The topic ‘Change labels for the additional fields’ is closed to new replies.
