Home › Forums › Calendar Products › Events Calendar PRO › Blog sidebar appears when category archive page returns "no results"
- This topic has 20 replies, 5 voices, and was last updated 9 years, 5 months ago by
Ruth.
-
AuthorPosts
-
October 19, 2016 at 7:58 pm #1179625
Ruth
ParticipantHi there
We currently have a main events page that exludes the category “community” and its subcategories, as well as a page that displays the category archive for “community”, effectively creating two events pages.
The problem we are experiencing is if a user goes to the “community events” page ie. category archive, then selects ANY other category or subcategory from the filter bar. Even if events exist in the category selected, no results are found AND the blog sidebar appears. The community events archive page displays correctly in the first instance. It’s only when a new category is selected from the filter bar that the problem arises.
If a user then selects ANOTHER category or subcategory from the filter bar after receiving the “no results” message, the correct events are displayed, however the blog sidebar remains. I’ve been struggling with the “no results” issue for a while, but the blog sidebar appearing is a fresh problem that only appeared after updating to 4.3.
The problem with the sidebar appearing if there is are “no results” returned does not happen on the main events page. Only the “community” category archive page.
Thanks
KateOctober 19, 2016 at 8:33 pm #1179643Ruth
ParticipantSorry… that was all a long way of saying that when the “community events” page (which is a category archive page using the correct page template) returns “no results”, it switches from the default page template to the blog archive page template. So I can avoid the sidebar appearing by removing the sidebar from the blog archive page template, but I WANT the sidebar to appear on the blog archive page. I do not want the page template to change to the blog archive template if “no results” are found when using the filter bar.
October 20, 2016 at 2:16 pm #1180127Cliff
MemberHi Donna. Sorry you’re experiencing this.
Could you please provide me some links, annotated screenshots, and/or video screen recording to demonstrate it so I can try to reproduce it?
October 20, 2016 at 5:35 pm #1180242Ruth
ParticipantHi Cliff
Community events page: http://southernharvest.org.au/events/category/community/
No result when selecting a subcategory: http://southernharvest.org.au/events/photo/?action=tribe_photo&tribe_paged=1&tribe_event_display=photo&tribe_eventcategory=26
Gets correct result when selecting another subcategory: http://southernharvest.org.au/events/photo/?action=tribe_photo&tribe_paged=1&tribe_event_display=photo&tribe_eventcategory=30&tribe_eventcategory=30
Gets correct result when selecting the previously attempted subcategory: http://southernharvest.org.au/events/photo/?action=tribe_photo&tribe_paged=1&tribe_event_display=photo&tribe_eventcategory=26&tribe_eventcategory=26
Video of each of those steps in order: http://screencast.com/t/QoLsWK2n
Thanks
KateOctober 21, 2016 at 7:38 am #1180527Cliff
MemberDo you have any events in the Dining category? http://southernharvest.org.au/events/category/dining/
(same category as http://southernharvest.org.au/events/photo/?action=tribe_photo&tribe_paged=1&tribe_event_display=photo&tribe_eventcategory=26)You can visit wp-admin > Events > Event Categories > look at the count of published posts column.
I saw http://southernharvest.org.au/events/category/gardening/ did have 1 event
(same category as http://southernharvest.org.au/events/photo/?action=tribe_photo&tribe_paged=1&tribe_event_display=photo&tribe_eventcategory=30&tribe_eventcategory=30)When I follow along like your video: click Filter Bar’s Dining (zero results), click Gardening (1 result), click Dining again (1 result — before it was zero)… I don’t get that same 1 result.
October 30, 2016 at 6:05 pm #1185114Ruth
ParticipantHi Cliff
Sorry for taking so long to respond.
The last dining event has passed, so no, there aren’t currently any events in the dining category. However, I can replicate the behaviour in the video by firstly selecting “cooking” (no results, sidebar template displays), then “markets” (results, sidebar template remains), then “cooking” (results, sidebar template remains) while on the Community Events page.
Selecting “cooking” on the main events page works as expected. No sidebar template appears, even if I select a category with no results (eg. “dining”).
But I seem to have found the origin of the problem. In another thread, I asked for assistance to be able to hide the “community” category and its subcategories from the main events page, so I could essentially create two events pages that didn’t display the same content.
This is the code I was given:
add_action( ‘pre_get_posts’, ‘exclude_events_category’ );
function exclude_events_category( $query ) {if ( is_admin() || !isset( $query->query_vars[‘eventDisplay’] ) || tribe_is_community_my_events_page() ) return $query;
if ( $query->query_vars[‘eventDisplay’] == ‘upcoming’ || $query->query_vars[‘eventDisplay’] == ‘past’ || $query->query_vars[‘post_type’] == Tribe__Events__Main::POSTTYPE && !is_tax(Tribe__Events__Main::TAXONOMY) && empty( $query->query_vars[‘suppress_filters’] ) ) {
$query->set( ‘tax_query’, array(
array(
‘taxonomy’ => Tribe__Events__Main::TAXONOMY,
‘field’ => ‘slug’,
‘terms’ => array(‘community’),
‘operator’ => ‘NOT IN’
)
) );
}return $query;
}
When I remove the code, the Community Events page responds properly to making category selections from the filter bar. No sidebar template appears if there are no results.
I really need to keep the community events page out of the main events page, so they don’t crowd the ticketed workshops that are booked through the website.
Thanks and regards
KateOctober 31, 2016 at 11:47 am #1185393Cliff
MemberPlease try replacing
if ( is_admin() || !isset( $query->query_vars['eventDisplay'] ) || tribe_is_community_my_events_page() ) return $query;with this:
$ajax_or_main = ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || $query->is_main_query() || is_admin() || ! isset( $query->query_vars['eventDisplay'] ) || tribe_is_community_my_events_page() ) { return $query; }Let me know if that has any changes (desired or not).
Thanks.
October 31, 2016 at 11:47 am #1185394Cliff
MemberPlease try replacing
if ( is_admin() || !isset( $query->query_vars['eventDisplay'] ) || tribe_is_community_my_events_page() ) return $query;with this:
$ajax_or_main = ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || $query->is_main_query() || is_admin() || ! isset( $query->query_vars['eventDisplay'] ) || tribe_is_community_my_events_page() ) { return $query; }Let me know if that has any changes (desired or not).
Thanks.
November 2, 2016 at 4:04 pm #1186660Ruth
ParticipantSorry to say, that broke the site. Had to restore my backup functions.php to the child theme.
Kate
November 3, 2016 at 8:05 am #1186993Cliff
MemberDonna / Kate,
Please provide the full code you tried in your active theme’s functions.php file (the one that didn’t work).
FYI: Anytime you’re trying out new code, I’d suggest enabling WP_DEBUG and WP_DEBUG_LOG and sharing any PHP errors you see while changing tickets quantity, navigating your site’s home page, events page, single-event pages, and any other of your site’s pages relevant to this ticket.
Let us know what you find out.
Thanks.
November 8, 2016 at 8:39 pm #1189461Ruth
ParticipantThis reply is private.
November 9, 2016 at 8:03 am #1189623Cliff
MemberYou might try this code snippet:
https://gist.github.com/elimn/c47fb3e65d437c2479bd
It merges the existing tax query, unlike the other snippet. Note that others have reported that it does not work with Ajax queries.
I hope this helps.
November 9, 2016 at 6:15 pm #1190078Ruth
ParticipantBefore I try that snippet, I have just updated all the Modern Tribe plugins and now the page layout selection is being ignored entirely. I have tried all the page template options in the settings and they all return the same layout. The filter bar stubbornly appears above the events, when it should be to the side in a vertical layout and ignores the setting to be in the “closed” status.
http://southernharvest.org.au/events/
Things are getting worse, not better.
Kate
November 10, 2016 at 9:50 am #1190462Cliff
MemberDonna / Kate,
We always recommend using the latest versions of our plugins, but Avada essentially includes a copy of our core The Events Calendar plugin in their theme, and therefore there is naturally a bit of a delay in their theme updating their copy whenever we release an update. This could be the reason for any issues you are experiencing with Avada, and they may have an update to release soon. You will need to check with their support regarding any issues specific to their theming of our plugin(s).
I was able to re-create the issue about Filter Bar Vertical + Closed actually being Vertical + Open.
For that issue, I’ll mark this ticket as Pending Fix, which means this thread should receive a reply once the applicable fix has been released. I cannot guarantee when it will be fixed as it’s in the development team’s hands now. They need to assign it, code it, test it, and schedule it for release.
I apologize for this issue and appreciate your understanding and patience.
November 10, 2016 at 11:29 am #1190503Cliff
MemberUpdate: I’ve also confirmed the bug about the Filter Bar’s vertical display being above the calendar instead of in a sidebar format, like it should be.
Therefore, that issue is not specific to Avada, and this issue is scheduled (not guaranteed) to be fixed soon (weeks).
If you’d like to downgrade to a previous version, you can get those from your Downloads (see each plugin’s version number drop-down).
Besides these 2 issues that I’ve got logged with our developers, please let me know if there are any other issues still to address in this thread.
-
AuthorPosts
- The topic ‘Blog sidebar appears when category archive page returns "no results"’ is closed to new replies.
