How to Exclude Events from Blog Archives and Search Results

Home Forums Calendar Products Events Calendar PRO How to Exclude Events from Blog Archives and Search Results

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #840869
    rtwdave
    Participant

    How can I exclude event listings from my blog’s archives and search results?

    #841276
    Brook
    Participant

    Howdy rtwdave,

    That is totally doable. This snippet will allow you to limit your search results. Although, if you want to include apges as well as posts you shoudl replace ‘post’ with with an array of all the post_types you want, including pages.

    Using a similar function it would be totally possible to exclude events as well. Somthing like if(is_archive() && !is_event_query()) { ... }

    Does that all make sense? Does it answer your question? Please let me know. Cheers!

    – Brook

    #844467
    rtwdave
    Participant

    I’m a little confused. I used the snippet exactly as it was provided and it has filtered out the events from appearing.

    Are you saying that as a result, it’s also filtered out pages from appearing?

    I’d prefer if pages continue to appear in the search results, it’s just the pages associated with events I’d like to keep out. I’m not sure I follow how to accomplish that. Can you please clarify?

    #848805
    Brook
    Participant

    Howdy rtwdave,

    For sure. My above both was rife with spelling errors. Sometimes my fingers and I don’t agree on which key to hit 🙁 . But, hopefully I can expound on it a bit. To include pages and other post types as well as posts you need replace ‘post’ in that snippet with a PHP array of all the post_types you want, including pages.

    Does that make more sense, especially now that it is in proper English?

    – Brook

    #877619
    rtwdave
    Participant

    Still a little lost. I have a developer working on something for my site now, I may just ask him to make this change instead of me.

    #877705
    Brook
    Participant

    That’s probably a banner idea. If you are not a developer, then diving into PHP snippets and WP post_types will be quite confusing.If your dev has questions though we will gladly work with him. This sort of thing should be trivial for a dev familiar with the WP API, especially with a snippet like the above to work from.

    – Brook

    #913788
    Brook
    Participant

    Since this topic has gone for a spell without a response I am going to archive it. Thanks for posting! – Brook

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘How to Exclude Events from Blog Archives and Search Results’ is closed to new replies.