Posted: January 27, 2020 at 4:54 am
Hi, Any suggestions here? Thanks in advanced! |
|
Hi, The following is the correct syntax for checking 1) if it’s an Event Espresso event post type and 2) if it has a matching event category:
and if your code is only being injected onto EE event posts, then you can simplify the conditional:
Since you mention you’re adding the code into a functions.php file, may I ask how is the code being triggered? Is the code within a function that’s hooked to an action or filter hook? |
|
This reply has been marked as private. | |
Hi, The reason the conditional doesn’t work is because it was placed before the function starts. You’ll need to move the conditional so it’s within or inside the function. Also, there’s no need to include the ACF plugin file. It’s already activated. It would be a good idea to do a check |
|
This reply has been marked as private. | |
No, the licensing has no effect on Event Espresso’s functionality other than for updates and support. The functions you are trying to hook into With action hooks you do something like:
Right now you basically have this:
Which means it’s not hooking into anything as nothing calls my_callback_function. Move that out of the function itself, just below the I highly recommend you take a look at how to use hooks, this helped me get to grasps with them a while back: https://www.smashingmagazine.com/2011/10/definitive-guide-wordpress-hooks/ There are likely others now.
|
|
No the license key is definitely not the reason. You will not be able to run updates on more than one site with the key activated. That’s the effect of having that key on two sites. |
|
Thanks for all the help, Josh. You made my day! I will certainly look into the link on wp-hooks. |
|
The support post ‘EE4 and ACF: show content based on espresso event category’ 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.