WordPress.org

Forums

Events Manager
[resolved] Search from post categories (18 posts)

  1. atsqs
    Member
    Posted 9 months ago #

    Hello,
    I followed this tutorial to have same categories for posts and events : http://wp-events-plugin.com/tutorials/using-additional-custom-taxonomies/ and it works well, to choose a post category when creating an event, thanks !
    I just have a problem with the search form : no categories are display. Then, same for the calendar widget, when I put a post category ID which I have some events, nothing appears.
    How can I do ?

    Regards.

    https://wordpress.org/plugins/events-manager/

  2. angelo
    NetWebLogic Support
    Posted 9 months ago #

    with regards to events search form, maybe you can try this tutorial - http://wp-events-plugin.com/tutorials/adding-custom-event-search-form-fields/

  3. atsqs
    Member
    Posted 9 months ago #

    Hi,
    I tried your tutorial but I am not used with this kind of things (I am new in wp). Can you help me please ? I don't really know with what I can remplace 'Style' in the first function (I tried with category and post_category and obviously it didn't work). How can I get the event post category ?
    And then for the second function (with the filter), to what $searches= 'style' is referring ? I am lost...
    Regards.

  4. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Can you explain a bit more about what you're trying to do? That might make it easier to offer some pointers. Thanks.

  5. atsqs
    Member
    Posted 9 months ago #

    Hello,

    I just want my events have the same categories as my posts.

    I followed this tutorial : http://wp-events-plugin.com/tutorials/using-additional-custom-taxonomies/ and the events now share the post categories.

    But in the Events Manager search form and the calendar, these categories are not considered ! So, what I want is the use of post categories instead of event categories.

    Then, I try this tutorial http://wp-events-plugin.com/tutorials/adding-custom-event-search-form-fields/ to add the post categories in the search form, but I really don't know by what I should remplace 'style' ('post_category' ? 'category' ? didn"t work...).

    Regards.

  6. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Ok, thanks. There's an easier way to change the search category dropdown than using the second tutorial.

    Instead, you can edit the template at /events-manager/templates/templates/search/categories.php. Because you're using the standard WordPress
    categories, you should be able to replace this line

    wp_dropdown_categories(array( 'hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class'=>'em-events-search-category'));

    with this one (which removes the instruction to use the Events Manager categories)

    wp_dropdown_categories(array( 'hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class'=>'em-events-search-category'));

    You might want to take a look at this tutorial which shows you how to use custom templates in an upgrade safe way:
    http://wp-events-plugin.com/documentation/using-template-files/

  7. atsqs
    Member
    Posted 9 months ago #

    Hello,

    Thank you for your answer!
    The code you gave me is efficient to change the search category dropdown, so the post categories appear as expected. But there is another problem : when choosing one of them and click on the seach button, no events are found while there are some in the selected category. It seems like something missing.

    Then, there is a solution for showing post categories in calendar widget instead of event categories ?

    Regards.

  8. atsqs
    Member
    Posted 9 months ago #

    Hello again,
    I tried some replacement in the code above to have the search I would like but I am not so familiar with wordpress so it doesn't work.
    I am hopeless, can someone help me again please ?

  9. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Can you post the code you're using?

    Don't forget to the use code button so it doesn't get mangled by the forum software :)

  10. atsqs
    Member
    Posted 9 months ago #

    Hello caimin_nwl :)
    I have the code that you posted me before and I know that it can only change and display post categories instead of event categories in the dropdown search form.
    Then, I do not really know where I should change the code to search in post categories. Can you explain me please ?
    Regards

  11. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Am I right in thinking you want to have a search box that searches through both posts and events?

  12. atsqs
    Member
    Posted 9 months ago #

    You are close but it is not that !
    I just want the search box searches only event in the post categories.

  13. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Can you post a link to your site? I think that'll make it easier to see what's happening / not happening...

  14. atsqs
    Member
    Posted 9 months ago #

    Hello caimin_nwl, sorry for being late.
    I can't provide you any link because the site is actually only on local.
    I will try to explain the problem in the better way :

    Events and posts share same categories (this point is ok). So, in the search form, the users can search events with the category dropdown. In this dropdown, they should have the choice between the different post categories (this point is ok, you give me the trick).
    But then, if I have events in the category A, when I search for 'A' in this dropdown, the result remains empty. It is like there is no event in the category A.
    I hope I was clear :/

  15. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Just to make sure I get it... The problem is that you're not able to use the category name as a search term and get results?

  16. atsqs
    Member
    Posted 9 months ago #

    This is almost it !
    With the code you provided before, I am able to use (post) category name as a search term (they appear in the dropdown search). But there is no results !

  17. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Do you mean no results when you search for a post category name or no results when searching for anything?

  18. atsqs
    Member
    Posted 9 months ago #

    Just for post category name, even if some events have this category name.

Reply

You must log in to post.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.