Blog sidebar appears when category archive page returns "no results"

Home Forums Calendar Products Events Calendar PRO Blog sidebar appears when category archive page returns "no results"

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #1179625
    Ruth
    Participant

    Hi 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
    Kate

    #1179643
    Ruth
    Participant

    Sorry… 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.

    #1180127
    Cliff
    Member

    Hi 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?

    #1180242
    Ruth
    Participant
    #1180527
    Cliff
    Member

    Do 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.

     

    #1185114
    Ruth
    Participant

    Hi 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
    Kate

    #1185393
    Cliff
    Member

    Please 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.

    #1185394
    Cliff
    Member

    Please 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.

    #1186660
    Ruth
    Participant

    Sorry to say, that broke the site. Had to restore my backup functions.php to the child theme.

    Kate

    #1186993
    Cliff
    Member

    Donna / 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.

    #1189461
    Ruth
    Participant

    This reply is private.

    #1189623
    Cliff
    Member

    You 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.

    #1190078
    Ruth
    Participant

    Before 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

    #1190462
    Cliff
    Member

    Donna / 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.

    #1190503
    Cliff
    Member

    Update: 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.

Viewing 15 posts - 1 through 15 (of 20 total)
  • The topic ‘Blog sidebar appears when category archive page returns "no results"’ is closed to new replies.