WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Events category search (10 posts)

  1. John O
    Member
    Posted 3 years ago #

    Hi,

    First up just wanted to say this plugin is superb.

    I am currently working on a project using your plugin, and my client wants the events section of her website to be searchable.

    I know it is possible to alter the main WP search to limit results to one specific category, but I wondered if it was possible to make events data outside of the normal post content searchable, e.g. venue?

    Thanks.

  2. coreymcollins
    Member
    Posted 3 years ago #

    I wanted to chime in on this one because I'm having the same issue. I'm not getting results for the events, even when I tell the results to specifically ONLY posts in the events category. Is there a reason they shouldn't be coming up? They are added as regular posts, so it would seem that they would pop up with the rest of the posts.

    Would love to hear back on this one, as it's really the only feature that's holding me back from using this otherwise great plugin.

    Thanks!

  3. John O
    Member
    Posted 3 years ago #

    The only way I could get around this was to create a secondary category called 'events-search' and categorise every event with that too, then search that. It's a nasty solution, but the only way I can get events to be searchable.

    There is something weird going on with the events category though, as when I wrote a WP query to pull posts out by category, it ignores any in the events category.

    :-/

  4. coreymcollins
    Member
    Posted 3 years ago #

    That's really strange - I tried that solution, too, but I haven't had any luck in actually making it work. I guess I'll have to jump back in and look at it again.

    Would you mind posting your code to see if I can spot the differences between yours and mine? I've got it querying posts in the new category I had created, but it comes up blank. It works for other categories, which is what's really puzzling me.

  5. coreymcollins
    Member
    Posted 3 years ago #

    I actually just figured out a way to do this!

    At the top of my search.php file, I've implemented this code:

    <?php
    $args = array(
    	'cat'      => 12,
    );
    ?>

    When I query the posts for the results, I call this:

    <?php query_posts($args); ?>

    And voila! Works flawlessly, as far as I can tell.

  6. John O
    Member
    Posted 3 years ago #

    Hi - I'll give that search code a go today - are you still passing a hidden field along with the search form submission to search.php e.g.

    <input type="hidden" name="cat" value="1" />

    The query code I have for the other thing is:

    $featured_query = new WP_Query('category_name=Events&showposts=4');
    while ($featured_query->have_posts()) : $featured_query->the_post();
    $do_not_duplicate = $post->ID;

  7. coreymcollins
    Member
    Posted 3 years ago #

    I meant to come back and post again, but work has been nutso lately. Turns out, my "solution" didn't actually work upon closer inspection. It was just giving me the posts in that category anytime I searched anything. Back to the drawing board... again.

  8. coreymcollins
    Member
    Posted 3 years ago #

    One thing I noticed earlier today, though it might be any kind of breakthrough - you CAN search the events by searching for the title or actual post content. However, the additional info that's added (Location, Venue, etc.) isn't searchable.

    Not sure if this will help point toward a solution or not, though.

  9. coreymcollins
    Member
    Posted 3 years ago #

    Alrighty, I found a... well, not a solution, but a workaround.

    If you install Search Everything (http://wordpress.org/extend/plugins/search-everything/) and select "Search Metadata" in the options, events listed in The Events Calendar will now display in the search results. I originally installed the plugin to be able to search tags, but it works for this as well.

  10. John O
    Member
    Posted 3 years ago #

    Apologies for delay in replying - I must give this a go!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic