Home › Forums › Calendar Products › Events Calendar PRO › Remove Event Posts from Tag Archives
- This topic has 9 replies, 3 voices, and was last updated 10 years, 3 months ago by
Support Droid.
-
AuthorPosts
-
January 13, 2016 at 2:10 pm #1055575
Anthony
ParticipantI’m looking for an easy way to remove event posts from tag archives.
Even when I filter my query by post type ‘post’ the events are still in the results.
How can I get just my standard wordpress posts on tag archives / queries without events in there too?
January 13, 2016 at 3:33 pm #1055640Barry
MemberHi Anthony,
You could try adding the following snippet either to your theme’s functions.php file or else to a custom plugin:
/** * Show nothing but posts in tag archives. * * @param WP_Query $query */ function just_posts_in_tag_archives( WP_Query $query ) { if ( ! $query->is_tag ) return; $query->set( 'post_type', 'post' ); } add_action( 'parse_query', 'just_posts_in_tag_archives', 100 );Does that help?
January 19, 2016 at 11:25 am #1058781Anthony
ParticipantThank you, I added the code to my functions.php file, and unfortunately I’m still getting events in the tag queries.
Here is an example of where it is occurring: http://milwaukeefoodcouncil.org/food-system/farmers-markets/
I’m trying to get posts only on top, and events only on bottom, on tag archive pages. Or, just posts on top without events on the bottom would be fine too.
However, the events on the bottom piece is working fine, but I can’t get the events filtered out of the posts on the top, which is the main thing I am looking for.
This is a genesis based implementation. Please advise.
January 19, 2016 at 12:41 pm #1058828Barry
MemberHi Anthony,
I’m not sure what to suggest as it does work for me locally.
Could you share your complete theme functions.php file (ideally via a Pastebin or Gist link) so I can take a look at where you added the code?
Thanks!
January 19, 2016 at 1:18 pm #1058839Anthony
ParticipantNo problem, here it is:
January 19, 2016 at 1:46 pm #1058853Barry
MemberThanks for sharing, though I’m afraid nothing obvious is jumping out at me there.
On a clean installation with only a default theme, though, it does appear to me to work as expected. Quite why it’s failing in your case I’m not sure and, as customizations/custom dev tasks are something we can only offer very limited support for, I’m afraid I’ll need to leave the rest in your hands.
Sorry I couldn’t get you what you needed on this occasion, but hopefully you’re able to come up with a working solution of your own 🙂
January 19, 2016 at 3:45 pm #1058905Anthony
ParticipantOk, I understand you can only go so far with the support for customization.
I am just wondering, if it’s not asking too much, and if you have not done so, could you maybe try it on a genesis framework installation?
January 19, 2016 at 5:02 pm #1058920Barry
MemberOK – I just tested with Genesis and ….. same result as you experienced!
Curiosity has the better of me now. Give me a little longer and I’ll see if there’s any obvious reason it doesn’t work under Genesis.
January 19, 2016 at 5:04 pm #1058921Barry
MemberActually, I take that back – the snippet does seem to work with Genesis (just the latest base theme, I didn’t try with any child themes).
With that in mind, it could be worth performing a similar test of your own: if you strip things down to just our plugins, that snippet and the basic Genesis framework does it work for you then?
Assuming it does, if you start reactivating the other components one-at-a-time do you find it suddenly stops working?
February 18, 2016 at 8:35 am #1076936Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Remove Event Posts from Tag Archives’ is closed to new replies.
