List view of categories stopped working

Home Forums Calendar Products Events Calendar PRO List view of categories stopped working

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #961961
    Stacey
    Participant

    I got some help from you a while back on setting up and override to make categories display in list view by default. It was working fine and now it stopped working. I think this might be because the Event Pro plugin has been updated. We get a message on the page that reads “No matching events listed under Classes. Please try viewing the full calendar for a complete list of events.” I am using a child theme and this is what is in the child’s function.php file, can you help me resolve this issue? Here’s the URL to the specific page. http://www.heartwoodcenter.com/events/category/classes

    // Overrides every request for viewOption from TribeEvents::getOption()
    function tribe_swap_default_category_view ($option, $default, $optionName) {
    // For a list of acceptable views/values run print_r(tribe_events_enabled_views());
    $default_events_view = ‘month’; // The default view for the main page, venue, etc.
    $default_category_view = ‘list’; // The default view for any calendar category
    if ($optionName === ‘viewOption’) {
    // Default category view is saved as a rewrite rule
    // Every other view checks viewOption on front-end page load
    // Hack: Since rewrites are usually only saved/flushed from the admin area, check that
    if( is_admin() ) {
    $option = $default_category_view;
    } else {
    $option = $default_events_view;
    }
    }
    return $option;
    }
    add_filter(‘tribe_get_single_option’, ‘tribe_swap_default_category_view’, 1, 3);

    #962013
    Barry
    Member

    Hi Terri,

    I’ll make a note for us to revise that knowledgebase article. In the interim, can you try this alternative snippet?

    https://gist.github.com/barryhughes/c772692a1dca698c955e

    It should force all event category requests to list view – the only downside is that someone viewing a category will still see options to switch to photo, week, month or day view, etc, which in turn will direct them back to list view – but that part of the problem would need to be solved separately.

    Despite that shortcoming, does this help at all if only as an interim measure?

    #962030
    Stacey
    Participant

    I tried to use the new snippet in place of my old one in the child’s function.php file, but no luck, same issue. Is there anything else we can try?
    Thanks.

    #962076
    Barry
    Member

    Hi Terri,

    I suspect that a few things may be at play here.

    The first is it doesn’t look like the code I suggested has been added (or perhaps it has been added to the wrong place, and/or something is blocking it).

    Did you remove the old snippet first of all – where did you add the new one? Also, via a service like Pastebin or Gist, can you share the file you added it to?

    The main reason I ask is that with the revised snippet if your default view is month view, which seems to be the case on your site, and you try to visit:

    example.com/events/category/boo

    It should redirect you to:

    example.com/events/category/boo/list

    In your case the URL doesn’t change when I request an event category which is what led me to the above questions.

    Hopefully we can figure things out, but if not it may be better to wait until the knowledgebase article in question is formally revised and you can give things another try at that point ๐Ÿ™‚

    #962098
    Stacey
    Participant

    Barry, thanks for working with me on this. Actually I’m Dave (Terri’s web designer). You were right, I tried your code, then switched back to what I had originally when it didn’t work. But I’ve set it up again as you asked and also pasted my CHILD theme’s function.php contents to Pastebin. Have a look. http://pastebin.com/r6C39G9V

    My page http://www.heartwoodcenter.com/events/category/classes does not redirect to http://www.heartwoodcenter.com/events/category/classes/list

    Also, when I add the /list to the end of my URL http://www.heartwoodcenter.com/events/category/classes I get the same message “No matching events listed under Classes. Please try viewing the full calendar for a complete list of events.”

    Let me know where we go from here.
    Thanks!

    #962113
    Barry
    Member

    Hi Dave,

    OK, so – again- something else may be at play.

    Do you have a test site at your disposal? What if you set up a clean WordPress installation with just our plugins and this snippet in the functions.php file of a child theme based on a default theme, like Twenty Fifteen?

    Do you find it works then (if so, it suggests a conflict somewhere along the line on your production site) or do you still hit problems?

    If you find it works you can of course begin adding the same stack of plugins, theme etc as on your live site in an attempt to uncover the source of the issue.

    Ultimately I’m afraid for a customization like this we aren’t going to be able to go into too much depth: we provide snippets and solutions via our knowledgebase (and occasionally on the forums) in the hope that they will be useful, but sometimes they need a little tweaking to make them mesh with a particular installation – and that is something we need to leave in your hands ๐Ÿ™‚

    Also, when I add the /list to the end of my URL http://www.heartwoodcenter.com/events/category/classes I get the same message โ€œNo matching events listed under Classes. Please try viewing the full calendar for a complete list of events.โ€

    It sounds like you are hitting up against this regardless of which snippet you use or even if neither is in place, is that correct? If so then this is a further indication of some deeper problem which our standard troubleshooting steps may help you to uncover.

    #962129
    Stacey
    Participant

    Barry, before I set up a test WP site, maybe we can come at this from another angle. When I built the site I used the old snippet of code that I got from your company’s support. With a little guidance from your techs we got it working exactly as we wanted. Then recently your plugins were updated and this function stopped working. Is it possible to tweak the original code to get it working again?

    Basically we want a specific “category” to show as a list view. I can get all of the events to list via this link http://www.heartwoodcenter.com/events/list and this is exactly what we’d like but only list one particular category, in our case the category would be “classes”. Even if we had to hard code this to work with only the Classes category that would be okay.

    Any thoughts? It seems a reasonable feature for your plugin to have, no?

    #962136
    Barry
    Member

    Hey Dave,

    So when it comes to customization work we can try and point you in the right direction where possible – but ultimately customizations are things that need to be driven forward and maintained by you.

    In this case the old snippet seems to me to no longer be a viable way of forcing categories to show in list view and we’ll revise it as soon as we reasonably can.

    The new snippet I provided seems to work (on a clean installation) and I’m unsure why it fails on your particular site, but as we already covered it seems some other problem is at work there in respect of list view and event categories.

    I can get all of the events to list via this link http://www.heartwoodcenter.com/events/list and this is exactly what weโ€™d like but only list one particular category, in our case the category would be โ€œclassesโ€. Even if we had to hard code this to work with only the Classes category that would be okay.

    OK, so that’s a slightly different request in that you are asking how to limit list view to only showing one category, rather than how to force all event categories to be presented via list view.

    I’m reluctant to explore it here in this topic for a couple of reasons:

    • Event categories in list view are malfunctioning on your site as it is, so I don’t want to try and explore a further customization while that problem remains
    • We have a policy of sticking to one issue per topic and I feel this is essentially a different customization from the one we have been discussing so far

    It seems a reasonable feature for your plugin to have, no?

    I’m not sure I agree, but why not post this on our UserVoice page (or upvote any suitable existing request)? That way we will get a great sense of just how much demand there is and can potentially take the idea forward in a future release.

    Dave: I suggest before we go any further we clear up the problem with list view/your class category returning no results.

    Please confirm if this is a problem even without either of the snippets mentioned above in place – if that’s the case, I’d recommend troubleshooting to try and detect if there is an old customization you’ve forgotten about tripping things up and/or a straightforward plugin or theme conflict.

    #962153
    Stacey
    Participant

    Barry, thanks for all your thoughts. My client has decided to go with the monthly view (which works with the old snippet of code). They don’t want to spend the time and money to try to straighten this out. I’ll throw it up on the UserVoice page to see if anyone has the same need, maybe it’ll be added as a feature in future releases.
    Thanks,
    Dave

    #962176
    Barry
    Member

    Great – thanks Dave ๐Ÿ™‚

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘List view of categories stopped working’ is closed to new replies.