Get info from additional fields with php-function

Home Forums Calendar Products Events Calendar PRO Get info from additional fields with php-function

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1001039
    MT
    Participant

    I want to call information from my two additional fields without getting the label. I just want the “answer”.
    Right now I am using the following code <?php tribe_get_template_part( ‘modules/meta’ ); ?>.
    But this gives me all the information. I just want the additional fields.

    What function should I use for getting this.

    Below, I’ll paste the part from my functions.php that I’m working on, so you get the context.
    I will mark the function I need help with, with HERE IT IS so you easy can locate it below.

    $calendar_posts = new WP_Query( $args );

    if ( $calendar_posts->have_posts() ) :
    ?>
    <?php while ( $calendar_posts->have_posts() ) :
    $calendar_posts->the_post();

    $date = get_field( ‘_EventStartDate’ );
    ?>

    <div class=”col-sm-<?php echo $cols; ?> calendar-item”>
    ” title=”<?php the_title_attribute(); ?>”>
    <div class=”calendar-date”><?php echo mtg_date_form( $date ); ?></div>

    <?php the_title(); ?>

    HERE IT IS –> <?php tribe_get_template_part( ‘modules/meta’ ); ?>

    </div>
    <?php endwhile; ?>
    <?php
    wp_reset_postdata();
    else :
    ?>

    #1001668
    George
    Participant

    Hey Tommy,

    Apologies for the delayed response here!

    The simplest way to only retrieve the “additional fields” meta is to use this code:


    ob_start();
    tribe_get_template_part( 'pro/modules/meta/additional-fields', null, array(
    'fields' => tribe_get_custom_fields(),
    ) );

    $html = ob_get_clean();

    If you then echo the $html it should just be the additional fields content:

    echo $html;

    I hope this helps!

    Cheers,
    George

    #1001690
    MT
    Participant

    Thanks, it’s getting there ;).

    Now I get a list with a header (named OTHER) and the labels and inputs in the additional fields.
    I want to just echo the “answers” in the additional fields without the label and being able to call on them one and one so I can format them separate.

    Let’s say that there are four additional fields in the admin interface. They consist of a predefined label and a selector where the admin user can select one “answer” from a DropDown-menu. We than have:
    Label of field 1 – The selection or answer chosen to field 1.
    Label of field 2 – The selection or answer chosen to field 2.
    Label of field 3 – The selection or answer chosen to field 3.
    Label of field 4 – The selection or answer chosen to field 4.

    Now I want to be able to echo only the selected answers. And I want to be able to call on the answer to field 1 separate from calling on the answer to field 2 etc.

    What should I do to accomplish this?

    #1002104
    George
    Participant

    Hi Tommy,

    Can you share a link directly to where there is an example of this on your site? If your site is private for development or something, I totally understand that – however, we cannot log into user sites, so if this is the case, can you temporarily make the site public so we can see it first-hand?

    The things you’re looking for here might be mostly achievable with some CSS. We don’t support custom code here, just to put out that disclaimer, but I’m happy to take a look and offer any advice that I can.

    Thank you,
    George

    #1002142
    MT
    Participant

    Hi and thanks for your reply George.

    So, I will give you the context. The company creates events in Eventbrite. Eventbrite is automatically connected to a market automation system (Pardot) which only imports the title. So the title has to be written with more information that is good looking for a title on a webpage. So when the event is imported to the web site from Eventbrite I want to be able to have some special fields with a title for the webpage and some other information to be shown only on the website. So the alternative title and other special information for the website would then be possible for the user to write directly into eventbrite together with the other information, but WordPress will only output some chosen fields of the information.

    My first and hardest issue is to make this happen to the following calender on this site’s frontpage. http://www.mtgruppen.se

    The current calendar on the frontpage only outputs the date and the title. I would like it to instead output the date and three additional fields that the user input when he/she creates the event in eventbrite. With additional fields I actually mean the function additional fields, so I can customize some fields for this mission.

    Please tell me if you want me to be more clear and precise!

    Thanks,
    /Tommy

    #1002931
    George
    Participant

    Hey Tommy,

    I appreciate the additional information here – and your patience with my delayed response over the three-day weekend here in the US!

    Unfortunately, this seems to be the essence of your customization request and it leads to a bit of bad news:

    I would like it to instead output the date and three additional fields that the user input when he/she creates the event in eventbrite.

    The “bad news” here that achieving what you wrote, what I quoted right above, is actually much more complicated than it might seem and it involves adding a lot of extra code to our Eventbrite add-on, to pull in information from the Eventbrite API which itself might not allow the addition of extra information like this 🙁

    I’m sorry to bear this bad news, but hope that some sort of consolation can come from the fact that there are many Customizers and developers out there who could probably help you pull this off. We have a list of them here, for example → https://theeventscalendar.com/find-a-customizer

    Let me know what your thoughts are on all of this, and if there’s anything else I can help with.

    George

    #1007807
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Get info from additional fields with php-function’ is closed to new replies.