Home › Forums › Calendar Products › Events Calendar PRO › Categories in list view, main event page as calendar view
- This topic has 6 replies, 2 voices, and was last updated 11 years, 8 months ago by
matthewdenton.
-
AuthorPosts
-
July 10, 2014 at 8:40 am #335495
Lawrence Hirsch
ParticipantI tried this tutorial with current version of Events Pro and it won’t work for me. Has something changed?
https://theeventscalendar.com/support/documentation/display-categories-in-list-view/
July 10, 2014 at 10:46 am #336379Lawrence Hirsch
ParticipantI have tried disabling all other plugins, but still can’t get this to work. I tried the function addition to my child functions and alternatively to the theme, but neither work.
July 11, 2014 at 7:29 pm #352938matthewdenton
MemberHi:
Thanks for reaching out to us and I’m sorry to hear you are having trouble with the tutorial. I quickly added the code snippet to my test site and I am seeing that Categories are now displayed in the “List” view instead of the “Month” view.
If it is not a hassled can you re-confirm that the code snippet is not working.
- Place the code in your current theme’s functions.php file
(functions.php of active theme) - Event Settings : Default View property is set to “Month”
- Viewing the calendar ../events/ shows the Month View
- Go to a Category page …/events/category/category-name it should redirect to ../events/category/category-name/upcoming/
Also to make trouble shooting easier can you confirm for me the name of your active theme? will let me know we are putting the code in the correct location.
Thanks in advance for your help,
– Matthew
July 14, 2014 at 9:20 am #380284Lawrence Hirsch
ParticipantSure, here;’s the code:
/**
* Forcing Categories to display in List View in The Events Calendar
*/
add_action(‘parse_query’, ‘use_list_view_for_categories’, 60);function use_list_view_for_categories($query) {
// Run once
remove_action(‘parse_query’, ‘use_list_view_for_categories’, 60);// Interfere only for non-ajax Tribe category requests not already destined to be presented by list view
if (defined(‘DOING_AJAX’) && DOING_AJAX) return;
if (!isset($query->tribe_is_event_category) || !$query->tribe_is_event_category) return;
if (tribe_is_view(‘upcoming’)) return;// Obtain the query term and get a link to list view for that term
$main_tax_query = $query->tax_query->queries[0];
$term = get_term_by(‘slug’, $main_tax_query[‘terms’][0], TribeEvents::TAXONOMY);
$link = tribe_get_listview_link($term->term_id);// Try to redirect
wp_redirect($link);
exit();
}Default is set to month view.
tried in current theme’s functions (as well as child theme)
../events/ shows the Month View.
category page …/events/category/upcoming/ ; this is still showing as monthJuly 14, 2014 at 9:34 am #380361Lawrence Hirsch
ParticipantThe active theme name is Santorini Resort v1.3 (CSS igniter). I also tested the function in TwentyThirteen and same result for me.
July 15, 2014 at 5:13 pm #399019matthewdenton
MemberHi!
I wanted to let you know that I am working on this. I ran the snippet against the Twenty Thirteen theme using your code and it doesn’t work due to left and right single quotes. I’m not sure how those got into your version of the code. Please copy the code directly from this gist and retry. I’ve copied it directly from my Twenty Thirteen theme that behaves as outlined in the tutorial while using version 3.6.1 of our plugins.
I hope this resolves the issue! If not please make sure to disable all other plugins and re-check.
Thanks for your patience resolving this issue.
– Matthew
August 4, 2014 at 9:56 am #579112matthewdenton
MemberHi, I wanted to quickly follow-up with you to see if you are all set or if you have further questions. Please let me know if you do have additional questions I can assist with or if I should go ahead and close this thread.
Thank you,
– Matthew
- Place the code in your current theme’s functions.php file
-
AuthorPosts
- The topic ‘Categories in list view, main event page as calendar view’ is closed to new replies.
