Display Categories in List View by Default

Home Forums Calendar Products Events Calendar PRO Display Categories in List View by Default

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #836161
    abqsangha
    Participant

    Early in 2014 there was a post with suggested code to add to the functions.php file of the theme to have the main events page display in Month View but all categories pages to display as List View.

    I added that code to my functions.php file but after I installed Calendar PRO 3.8, category searches didn’t redirect properly. I removed the “redirect” portion of the code. Now category searching works again, but I’ve lost the default List View.
    Sarah

    #840966
    Geoff
    Member

    Hi there, Sally! Thanks for getting in touch and sorry you’re running into an issue. Hopefully we can figure it out here together. πŸ™‚

    I was unable to locate the specific thread you were referring to, but have you seen our tutorial for this? It might give a better overview than the thread did, plus it includes a video walkthrough. I tried this and it worked, though it could have the effect of running too many redirect loops, depending on your setup. In other words, it’s not bulletproof.

    Another way of doing this would be to override the default-template.phpΒ file (located in the wp-content/plugins/the-events-calendar/views directory) and set up a condition that displays the appropriate template based on whether a category is being viewed. That would look something like:

    if (is_tax('tribe_events_cat')) {
    
    // If this is a category, pull template 'list'
    include(tribe_get_current_template('list'));
    
    } else {
    
    // If not a category, pull default set in options
    include(tribe_get_current_template());
    
    }

    Of course, this may need to be modified to suit your specific needs or theme. While that’s the sort of customization we’ll leave in your hands, this should point you in the right direction.

    There’s more information (including step-by-step examples) of how to create template overrides in our Themer’s Guide. I’d suggest heading over there to check that out as well.

    Does that make sense? Will that work for you? Please let me know. πŸ™‚

    Cheers!
    Geoff

    #841801
    abqsangha
    Participant

    Thank you for your response, Geoff. I had used the code in the tutorial for this problem. It worked well until release 3.8, when category searching stopped working all together. It appeared there was a redirect problem, and I deleted the part of the code that dealt with redirect:

    // Try to redirect
    wp_redirect($link);
    exit();
    With that change, category searching worked again but no longer defaulted to List View.

    I just tried your suggestion and saw no change in the category searching.
    I’m afraid I’m not well-versed enough in WP to figure out how I need to customize and will need to turn to my consultant. (Fortunately I have a development site, so that helps a lot-just didn’t see the problem when I tested 3.8.)

    Thanks,
    Sally

    #842093
    Geoff
    Member

    Thanks for following up, Sally! I’m sorry that snippet no longer seems to work. I’ve made a note so we can either update or remove it to prevent this sort of issue coming up again. I really appreciate you sharing this with us!

    I’m going to go ahead and close this thread, but please feel free to hit us up with a new thread if any other questions pop up. We’d be happy to help. πŸ™‚

    Cheers,
    Geoff

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Display Categories in List View by Default’ is closed to new replies.