Support

Home Forums Event Espresso Premium Adding Logic to Espresso_Events shortcode

Adding Logic to Espresso_Events shortcode

Posted: August 30, 2016 at 7:49 am

Viewing 10 reply threads


Andrew Moreton

August 30, 2016 at 7:49 am

Hi,

I’m using [ESPRESSO_EVENTS category_slug=”foo”] and it’s working well.

However I’d like to modify it’s behaviour a little by getting it to print a message if there are no events in that category.

Is this possible? Thanks,

Andrew


Tony

  • Support Staff

August 31, 2016 at 6:28 am

Hi Andrew,

EE should load a ‘content-none.php’ template file from within your theme if you have one, that should display that no posts are found for the shortcode.

Is that not happening currently?


Andrew Moreton

August 31, 2016 at 6:42 am

Hi Tony,

no for some reason the template isn’t loading – though I’d forgotten about it’s existence I had created and added content to it, which is not being shown by the [ESPRESSO_EVENTS] shortcode,

any idea?

thanks

Andrew


Tony

  • Support Staff

August 31, 2016 at 8:17 am

Hmm, ok so where exactly are you placing that template file? (Root of Child/Parent theme etc)

What currently shows when there no events, nothing at all?


Andrew Moreton

August 31, 2016 at 8:52 am

the template is at rootof the parent theme – and nothing shows at all when there are no events – not even in the DOM inspector. I know that’s not much to be going on!


Tony

  • Support Staff

August 31, 2016 at 10:46 am

You have your own custom content within content-none.php right?

If you install What The File and reload that page on the front end you’ll see a new menu bar item that shows all of the templates loading – http://take.ms/v0uYP

If you view the page using twentyfourteen (you can preview the theme from the admin if preferred) or similar do you see a message stating nothing was found?


Andrew Moreton

August 31, 2016 at 1:20 pm

Man, wish I’d known about What the File before!

– doesn’t seem to be picking up my content-none.php

Twenty-fourteen is giving me the nothing found message.

thanks,

Andrew


Andrew Moreton

September 1, 2016 at 1:57 am

Hi Tony,

I’ve fixed this issue – embarssingly was down to misformatted shortcode – blame this one on user error – sorry to have taken up your time,

Andrew


Tony

  • Support Staff

September 2, 2016 at 5:14 am

No time wasted here ๐Ÿ™‚ I’m just glad your up and running.

Can I ask what the problem with the shortcode was? โ€ instead of "?

Something to note from your initial post that I hadn’t noticed, category_slug=โ€fooโ€ you don’t need the quotes around the attribute value unless you have spaces within the value, it may not have caused problems previously but if a formatted quote gets in there it breaks the shortcode.


Andrew Moreton

September 5, 2016 at 1:06 am

It was curly brackets – schoolboy error!


Tony

  • Support Staff

September 5, 2016 at 3:12 am

Ahh, ok.

Glad you got it fixed ๐Ÿ™‚

Viewing 10 reply threads

The support post ‘Adding Logic to Espresso_Events shortcode’ 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