Home › Forums › Calendar Products › Events Calendar PRO › How to Exclude Events from Blog Archives and Search Results
- This topic has 6 replies, 2 voices, and was last updated 9 years, 5 months ago by Brook.
-
AuthorPosts
-
October 27, 2014 at 9:01 am #840869rtwdaveParticipant
How can I exclude event listings from my blog’s archives and search results?
October 27, 2014 at 11:08 am #841276BrookParticipantHowdy 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
October 28, 2014 at 11:37 am #844467rtwdaveParticipantI’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?
October 29, 2014 at 11:13 pm #848805BrookParticipantHowdy 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
November 11, 2014 at 3:30 pm #877619rtwdaveParticipantStill 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.
November 11, 2014 at 4:15 pm #877705BrookParticipantThat’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
December 9, 2014 at 11:05 pm #913788BrookParticipantSince this topic has gone for a spell without a response I am going to archive it. Thanks for posting! – Brook
-
AuthorPosts
- The topic ‘How to Exclude Events from Blog Archives and Search Results’ is closed to new replies.