get_the_id() inside of grid.php

Home Forums Calendar Products Events Calendar PRO get_the_id() inside of grid.php

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #934936
    Jon Nixon
    Participant

    Hi All,

    I can’t for the life of me figure out how to get the current event id inside of grid.php. I’m trying to pass the category slug as a class like so:

    $terms = get_the_terms(get_the_ID(), 'tribe_events_cat');
    
    echo 'terms = ' . $terms;
    			
    			?>
    				<td class="<?php 
     		$count = count($terms);
     		if ( $count > 0 ){
     		  
     		    foreach ( $terms as $term ) {
     		      echo $term->slug;
    
     		    }

    However, get_the_id(), $post->ID, etc returns nothing inside of this file. How do I get the post/event ID?

    #934996
    Brian
    Member

    Hello,

    Thanks for using our plugin. I can help you out here.

    What file exactly are you trying to get the id on? We have a bunch of files with grid in the name.

    Is it this one from the month view:

    the-events-calendar/views/month/loop-grid.php

    Let me know and I can try to help out.

    Thanks

    #935130
    Jon Nixon
    Participant

    Hi Brian,

    I’m trying to apply the categories to my local grid.php file:

    theme > tribe-events > widgets > mini-calendar > grid.php

    #935208
    Brian
    Member

    Ok thanks for the information.

    Since that is not a single event template there is no ID to get there for an event to show categories. It would most likely just get the page id the widget is on.

    That should be in this directory of your theme for the file as well:

    theme > tribe-events > pro > widgets > mini-calendar > grid.php

    To add categories you would want to look at using the single-event file in the widgets folder of pro:

    events-calendar-pro\views\pro\widgets\modules\single-event.php

    #943631
    Brian
    Member

    Since there is has not been any activity on this thread for over 2 weeks so I am now closing it. Feel free to start a new thread if you have further issues. Thanks! 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘get_the_id() inside of grid.php’ is closed to new replies.