Additional fields in list view

Home Forums Calendar Products Events Calendar PRO Additional fields in list view

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1038876
    andersonparks
    Participant

    I am trying to add one of my additional fields to the ECP list view. I have added the meta data for the additional fields to show in tribe-events–> list–>single-event.php. This is what I added.

    <div class="tribe-events-event-meta"><?php $fields = tribe_get_custom_fields();
    foreach ( $fields as $name => $value ): ?>
    <dt> <?php echo $name ?> </dt>
    <dd class="tribe-meta-value"> <?php echo $value ?> </dd>
    <?php endforeach ?>
    </div>

    While this is great because it shows all of them, I would like to only pull in one of them (specifically, the “register by” field) and it only display if there is content in the field? Please note the url has ~anderson at the end of it because it is a temp url.
    thanks!

    #1038878
    andersonparks
    Participant

    looks like my code did not format correctly for you in that last notice. trying again

    <div class="tribe-events-event-meta">
    <div class="additional-fields">
    <?php $fields = tribe_get_custom_fields();
    foreach ( $fields as $name => $value ): ?>
    			<dt> <?php echo $name ?> </dt>
    			<dd class="tribe-meta-value"> <strong><?php echo $value ?></strong> </dd>
    		<?php endforeach ?>
    </div>
    
    #1039046
    George
    Participant

    Hey @Allison,

    Thanks for reaching out – to just display one field, I’d recommend doing a var_dump() on that $fields variable directly.

    This will display all of the actual variable data for the fields.

    And so if you see that the key for the field you want is, for example ‘allison_example’, then you could replace that foreach loop with this:


    if ( isset( $fields['allison_example'] ) ) :
    // display name and value however you want
    endif;

    We unfortunately cannot help much with custom code, but I hope there’s enough here regardless to make some sort of contribution to your project 🙂

    Cheers!
    George

    #1076104
    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 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Additional fields in list view’ is closed to new replies.