WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] List All Categories, Get Next Event Thumbnail (22 posts)

  1. magus824
    Member
    Posted 2 years ago #

    Hello there! First, I would like to say thank you for the 2.0 update to this already great plugin.

    There are two things that I want to do, but haven't found the documentation for it, if someone could help?

    1) I would like to be able to list all categories above the calendar view, so that if someone wanted to just see the calendar within a specific event category, they would be able to. Example: Let/s say I have two categories, "East Coast" and "West Coast". When I am looking at the Event Calendar, I want to be able to have those categories listed, so that when someone clicks "West Coast", they get to see a calendar with just the items pertaining to "West Coast".

    2) I feel I should know this, but I can't figure it out: I would like it so that the "Next Event" widget will also show the thumbnail for that event.

    Thanks in advance for any help you can give me!

    http://wordpress.org/extend/plugins/the-events-calendar/

  2. Shane Pearlman
    Modern Tribe
    Plugin Author

    Posted 2 years ago #

    #1 - if you look in the template tags folder you will see a function called "tribe_meta_event_cats( $label=null, $separator=', ')". Use that to list out the cats and populate a select. Then use a bit of javascript to point the site to the category page (for example http://www.mysite.com/events/category/featured/) based upon the cat selected. It will take a bit of noodling but shouldn't be too hard.

    #2 - it is totally doable but I don't know the answer offhand (dead sick with the flu and traveling) - replying via email.

    best of luck

  3. magus824
    Member
    Posted 2 years ago #

    Thanks for the quick response, and sorry to hear about you being sick!

    So I tried using the "tribe_meta_event_cats('');" function, but what I am getting is only the first category. For an example of what is happening, see below:

    http://dev.mesacountylibraries.org/events/

    I tried calling all posts and listing categories, but then a single category gets listed more than once. Any help is again, appreciated, and I hope you get better!

    Thanks!

  4. TimCarey
    Member
    Posted 2 years ago #

    I'm looking for a similar solution. What category page? Not sure how to do this

  5. TimCarey
    Member
    Posted 2 years ago #

    A widget would be awesome

  6. TimCarey
    Member
    Posted 2 years ago #

    I'd tried the above code from Shane also. And I also only get one category not all of my categories. Does this function return an array of categories?

  7. TimCarey
    Member
    Posted 2 years ago #

    I found out the function above only shows the categories for the events on the single event page. And on the calendar if you are in the default calendar you will only show the categories for the current Day. I also tried adding it to the widget and the only show the category for you to upcoming events. No idea how to show all categories that are in a system for the events no matter what.

  8. magus824
    Member
    Posted 2 years ago #

    All right, for anyone in the future wondering how this can be done, I have been helped by the great people over at the Events Calendar Tribe website, and will put the code below:

    <?php
    
    		$terms = get_terms("tribe_events_cat");
     		$count = count($terms);
     		if ( $count > 0 ){
     		    echo "<ul>";
     		    foreach ( $terms as $term ) {
     		      echo "<li><a href='" . $term->slug . "'>" . $term->name . "</a></li>";
    
     		    }
     		    echo "</ul>";
     		}
    
    	?>

    What you do with this information is up to you! Happy coding!

  9. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Thanks Magus!

  10. TimCarey
    Member
    Posted 2 years ago #

    There is a problem with the link on this code. When you're in the certain category the links don't work. The following code works great.

    <?php
    		$terms = get_terms("tribe_events_cat");
     		$count = count($terms);
     		if ( $count > 0 ){
     		    echo "<ul>";
     		    foreach ( $terms as $term ) {
     		      echo "<li><a href='" .  get_site_url() . "/events/category/". $term->name." '>" . $term->name . "</a></li>";
    
     		    }
     		    echo "</ul>";
     		}
    
    	?>
  11. TimCarey
    Member
    Posted 2 years ago #

    Now that we have the linking problem gone, but how do we put this into the drop down. I think I know the HTML part, and but I assume there must be some kind of JavaScript needed to accomplish the link once someone chooses one of the categories.

  12. TimCarey
    Member
    Posted 2 years ago #

    Here is code for a drop down of categories. I put it into the grid view.

    <?php
    
    		$terms = get_terms("tribe_events_cat");
    
     		$count = count($terms);
    
     		if ( $count > 0 ){
    
    echo "<strong> Categories </strong>"; 
    
    echo "<script type='text/javascript'>function taclinkch(x){var y=document.getElementById(x).value;document.location.href=y}</script>";
     		    echo "<form action=''>  <select name='cats' id='cats' onchange='taclinkch(this.id)'>";
    
    echo "<option value='/*http://www.disabilityvoice.com/dvb/events/*/'>Select a Category</option>";
    
    echo "<option value='http://www.disabilityvoice.com/dvb/events/'>ALL</option>";
    
     		    foreach ( $terms as $term ) {
    
     		      echo "<option value='" .  get_site_url() . "/events/category/". $term->name." '>" . $term->name . "</option>";
    
     		    }
    
     		    echo "</select></form>";
    
     		}
    
    	?>
  13. TimCarey
    Member
    Posted 2 years ago #

    There is one error in the code above for the drop down menu in the grid view containing all the categories. Plus creating my own widget having all the event categories I install the widget called WP PHP Widget an and put some code into that widget. The code has to be different in the widget though for the addresses to work. Here's the code for both below. And also for it to work properly the select box of the grid view has to have a different ID than the idea of the select box in the widget. (ID or name)

    Code for drop down in grid view document

    <?php
    		$terms = get_terms("tribe_events_cat");
     		$count = count($terms);
     		if ( $count > 0 ){
    
    echo "<script type='text/javascript'>function taclinkch(x){var y=document.getElementById(x).value;document.location.href=y}</script>";
     		    echo "<form action=''>  <select name='eventcats' id='eventcats'   onchange='taclinkch(this.id)'>";
    
    echo "<option value=''>Select a Category</option>";
    
    echo "<option value='http://www.disabilityvoice.com/dvb/events/'>ALL</option>";
    
     		    foreach ( $terms as $term ) {
    
     		      echo "<option value='" .  get_site_url() . "/events/category/". $term->name." '>" . $term->name . "</option>";
     		    }
    
     		    echo "</select></form>";
    
     		}
    	?>

    Code for drop down of categories in the WP PHP Widget

    <?php
    		$terms = get_terms("tribe_events_cat");
     		$count = count($terms);
     		if ( $count > 0 ){
    
    echo "<script type='text/javascript'>function taclinkch(x){
    var y=document.getElementById('eventcatswidget' ).value;
    var currentURL=window.location.replace(y);
    }</script>";
    
    	    echo "<form action=''>  <select name='eventcatswidget' id='eventcatswidget' and onchange='taclinkch(this.id)'>";
    
    echo "<option value=' '>Select a Category</option>";
    
    echo "<option value='http://www.disabilityvoice.com/dvb/events/'>ALL</option>";
    
     		    foreach ( $terms as $term ) {
    
    		      echo "<option value='" .  get_site_url() . "/events/category/". $term->name." '>" . $term->name . "</option>";
     		    }
    
        echo "</select></form>";
     		}
    	?>

    If you need any help with this issue, contact me at tcarey@DisabilityVoice.us

  14. danceutah
    Member
    Posted 2 years ago #

    Is there a query variable that corresponds to the Category?

    What would fit my needs awesomely would be the ability to feed a category to the tribe_calendar_grid() function. I have modified this function to target a specific month with set_query_var( 'eventDate', '2012-05' );

    So, is there a query variable that corresponds to the Category or another way to accomplish this?

  15. TimCarey
    Member
    Posted 2 years ago #

    I'm not sure about this. Tell me what your adapted function you have above in your statement. Also what would you like this function to do on category. You probably could adapt my code into a function. Just instead of putting it in a select box it would actually go to the correct page indicating the category. Let me know if you need some help.

  16. danceutah
    Member
    Posted 2 years ago #

    I should have forked a new topic, but here goes.

    Original Function

    function tribe_calendar_grid()  {
      set_query_var( 'eventDisplay', 'bydate' );
      load_template( TribeEventsTemplates::getTemplateHierarchy('table') );
    }

    Modified to target a year/month

    function tribe_calendar_grid($Yr-Month)  {
      set_query_var( 'eventDate', $Yr-Month );
      load_template( TribeEventsTemplates::getTemplateHierarchy('table') );
    }

    Calling with '2012-06' produces the calender without any controls populated with events for that month.

    Basically all I want to do is embed a calendar or target a calendar page that displays a category. More than one filter would be ideal, so I could produce a calendar specific to a region and an event category.

  17. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Hey fellas. Still having problems on this? It might have been opened in a new thread (which I just haven't seen yet), in which case ignore my note...but I haven't seen any action here in a couple of weeks and wanted to check whether Modern Tribe could do anything in an official capacity. Let me know.

  18. TimCarey
    Member
    Posted 2 years ago #

    I think having all categories on a widget has been settled, but not allowing just one category. But I'm not sure what danceutah exactly wanted. But I like to know how you can tell what a subcategory is. Meaning my code above create a drop down of all categories. It would be nice if I can indicate somehow indicate some categories under each.
    I think danceutah should have made a different topic thread.

  19. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    For sure, Tim - danceutah, if you do see this, it'd be awesome if you opened a separate thread since that does seem unrelated to the core issue here.

    Allowing just one category in the widget is an available feature, but is only in PRO at this time and there are unfortunately no plans to backport that to the Free Events Calendar in the immediate future. Hope that helps and sorry I couldn't offer up more in this capacity.

  20. itemm
    Member
    Posted 1 year ago #

    Hello,

    very interesting subject, I tried to do some things like the list view.

    so I add this code:

    <?php
    $terms = get_terms("tribe_events_cat");
    $count = count($terms);
    if ( $count > 0 ){

    echo "<script type='text/javascript'>function taclinkch(x){var y=document.getElementById(x).value;document.location.href=y}</script>";
    echo "<form action=''> <select name='eventcats' id='eventcats' onchange='taclinkch(this.id)'>";

    echo "<option value=''>Select a Category</option>";

    echo "<option value='http://www.disabilityvoice.com/dvb/events/'>ALL</option>";

    foreach ( $terms as $term ) {

    echo "<option value='" . get_site_url() . "/events/category/". $term->name." '>" . $term->name . "</option>";
    }

    echo "</select></form>";

    }
    ?>

    that function very well, but when I choose a category, I have a 404 ereur??

    an idea?

  21. itemm
    Member
    Posted 1 year ago #

    I found it!

    as I am French, I have the plugin in French, so I forget to change this line:

    echo "<option value = '". get_site_url (). "/ events / category /". $ term-> name. '">". $ term-> name. "</ option>";

    it's good!

  22. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 1 year ago #

    Nice! Glad to hear you got this figured out, itemm. Looks like based on your note above you are all set here...I'm sure this will be of value to other French users who show up down the road, too. If you need anything else as you keep using the plugin please don't hesitate to give us a shout.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic