Change labels for the additional fields

Home Forums Calendar Products Events Calendar PRO Change labels for the additional fields

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #53096
    Chris
    Participant

    Hello, 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?

    #53236
    Barry
    Member

    Hi 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:

    http://pastebin.com/0Jmwju46

    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.

    #53299
    Chris
    Participant

    Thanks 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

    #53319
    Chris
    Participant

    Well, 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

    #53325
    Chris
    Participant

    Well, 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

    #53327
    Barry
    Member

    It 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.

    #53331
    Chris
    Participant

    Thanks 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

    http://pastebin.com/tkwTRpFB

    I’ll keep looking. If you can help, great.

    #53429
    Chris
    Participant

    Barry, 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.

    #54006
    Barry
    Member

    No problem – and definitely feel free to use our UserVoice page if you want to post this or any other feature requests:

    https://tribe.uservoice.com/forums/195723-feature-ideas

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Change labels for the additional fields’ is closed to new replies.