Support

Home Forums Event Espresso Premium More shortcode definitions, this time for Evt Reg Options> Active Status

More shortcode definitions, this time for Evt Reg Options> Active Status

Posted: February 14, 2022 at 9:56 am

Viewing 1 reply thread


ICLE

February 14, 2022 at 9:56 am

I am referring back to the ticket:
https://eventespresso.com/topic/need-a-shortcode-to-display-the-event-city/
Where it is stated I can mine for the methods on objects, thus quoth:

We have documentation for that system here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

I recommend using something like Kint:

https://wordpress.org/plugins/kint-debugger/

Wrap an EE model object in d(); (Example: d($event);) with the above plugin active and you’ll get a nice easy to follow output that shows you all of the methods available on that object to use.

I am setting up a quick development area in a localhost to try this out. I have the debug bar and kint installed.

Do I need to place the string:
d($event);
in its own file, in a page editor, in functions.php, its own plugin, or elsewhere? I missed the intro class as to how this is supposed to work exactly…

First time through the KINT door… any help is appreciated.


Tony

  • Support Staff

February 15, 2022 at 6:05 am

Hi there,

I haven’t posted details on where to get the object as it’s generally expected that if you’re writing your own custom code you know how to get the object you need to work with.

To answer your question on where to put the code, it depends on what you want to do. With the exception of the page editor (you can’t run PHP code within the editor unless you’re using a plugin to do it), you could use all of those options.

What I would recommend you do if you doing this locally and using Debug bar is to use Debug Bar Console:

https://wordpress.org/support/plugin/debug-bar-console/

That adds a ‘console’ section to debug bar where you can run PHP code.

Then you can do something like this:


$event = EEM_Event::instance()->get_one_by_ID(24640);
d($event);

(Your event ID that you pass to the function will obviously be different)

And console will output the kint output:

https://monosnap.com/file/iAS24A09ngDZWxg8kWMB6RiJqzMFZ2

General advice for using Kint and EE, never click the + sign that recursively expands all child elements and our models have many, some of which are also other models (which then have many children, some of which are models) of other entities…. it will likely crash your browser. So click on the blue bar instead to open up that specific child element.

Another option, its to create a custom page template and pull the EE_Event object into that in a similar wat to the above, then set that on a page and refresh to get Kint output directly to the browser.

(Note – kints is simply a library to give a better/nicer output than using something like plain old var_dump($event); there isn’t anything specific for kint here other than the fact that you are calling it using d();)

Viewing 1 reply thread

The support post ‘More shortcode definitions, this time for Evt Reg Options> Active Status’ 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