Hi
I have many events with the same title eg Project Management.
I wish to use the eo-event to display only the event with title project management. How do I do this?

Hayley Gillman
The API only supports search by title, (eo_get_events()
extends WordPress’ get_posts()
/WP_Query
API) i.e.
$events = eo_get_events( array(
's' => 'Project Management'
) );
will get events with a title like “Project Managment” (so it would return events with titles such as “This is not project management” and “project managements”. This might be good enough, but if not you would need to edit the SQL statement (using something like the posts_where
filter – http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where).
The best way to do this would be to use a custom query variable:
$events = eo_get_events( array(
'events_with_title' => 'Project Management'
) );
Then on the posts_where
filter, check if $query->get( 'events_with_title' )
returns something other than false
. And if so insert the SQL segment:
"AND post_title='XXXX' "
where XXXX is replaced by the properly sanitised value from $query->get( 'events_with_title' )
. (See $wpdb::prepare()
– http://codex.wordpress.org/Class_Reference/wpdb#Protect_Queries_Against_SQL_Injection_Attacks )

Stephen Harris
Hi Thanks for feedback
It is first option. ANy titile with proejct management.
$events = eo_get_events( array(
‘s’ => ‘Project Management’
) );
Please can you give me code I would like to show event, start date, end date.
When I put the code in wordpress it just appears as text and doesn’t do anything- I am working in text editor – please help

Hayley Gillman
Hi Hayley, they’re are examples here on displaying the results of eo_get_events()
: http://codex.wp-event-organiser.com/function-eo_get_events.html (see also this section in the documentation: http://docs.wp-event-organiser.com/querying-events/overview/).
You’ll need to wrap php code in <?php ... ?>
tags in order for it to be excuted instead of displayed. If you’re not sure, I’d recommend hiring a developer.
Or you can use the event list shortcode:
[eo_events s="Project Management"]

Stephen Harris