Support

Home Forums Event Espresso Premium EE4 Event Table view: How can I display additional user-defined fields?

EE4 Event Table view: How can I display additional user-defined fields?

Posted: March 2, 2017 at 3:07 am


greyowl

March 2, 2017 at 3:07 am

I have defined additional fields for my events and would like to display some of them in table format. How can I find the names of those variables and then display them?


Seth Shoultes

  • Support Staff

March 2, 2017 at 11:17 am

Hi there,

Here’s some information about customizing the table:
https://eventespresso.com/wiki/events-table-view-template-add-on/#customizations


greyowl

March 2, 2017 at 12:05 pm

Thanks for taking the trouble to respond, Seth, but this doesn’t help. I’ve been through all this with the help of Tony Warwick (do you know him? he was very helpful). My issue is that I have used the EE feature of adding Custom Fields for my events. They have a name and a value for each event. I need to be able to access such a variable and extract and display the content. This is not described in the examples you referred to.
I’d like to show you a screen shot but don’t know how to add one in this forum.


Tony

  • Support Staff

March 2, 2017 at 3:31 pm

It sounds like your using custom fields – https://codex.wordpress.org/Custom_Fields

That’s a standard feature within WordPress, the documentation doesn’t really go into details for custom fields as if your editing templates or adding customizations it would be expected that you are familiar with the above.

For a guide on custom fields take a look here: http://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/

To pull a custom field within the event table template you are using you can use something like this:

$some_variable = get_post_meta($post->ID, 'key', true);

‘key’ will be the ‘Name’ of your custom field, the true at the end of the function tells it to only return a single value for the key.


greyowl

March 3, 2017 at 1:44 am

Thanks again, Tony. That’s the tip I needed.
Two other Qs:

  • The Description field includes a New Line at the end. Cane I remove that so as to continue on the same line?
  • How can I display the content of the Price and a user-defined Price Modifier field?

  • Tony

    • Support Staff

    March 3, 2017 at 6:09 am

    Whilst we have no problem pointing you in the right direction if you need help (such as my reply above) we can not provide/support customizations, you need the help of a developer to make your customizations as the above is outside the scope of support for Event Espresso.

    If you prefer to add them yourself, you’ll need to learn how to use the EE models to pull in the information you need:

    https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-querying.md

    Prices are assigned to ticets, tickets are assigned to the datetimes and datetimes are assigned to the event, so if you have the event you can pull the datetimes and then pull the tickets for the datetime.

    Price modifers can be output using the models from the ticket object.

    One method to finding the available methods on each object is using the Kint Debugger plugin and then wrapping the object in d(); to see what is available on that object.

    The support post ‘EE4 Event Table view: How can I display additional user-defined fields?’ is closed to new replies.

    Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

    Event Espresso