Home › Forums › Calendar Products › Events Calendar PRO › add start and end time to month view under title
- This topic has 19 replies, 2 voices, and was last updated 10 years, 3 months ago by
Brian.
-
AuthorPosts
-
January 14, 2016 at 12:03 am #1055772
david
ParticipantI have seen this https://theeventscalendar.com/knowledgebase/add-start-time-to-event-title/ but it does not add the end time
I would like it to be”
“event title”
2pm-4pm“another event title”
6pm to 7pmand so on
I have no idea how to do this, I don’t like the hover and some of my clients can’t view the hover due to their work computer browser security so keep it simple event title and star + End times displayed please help
January 14, 2016 at 5:42 am #1055804david
Participantnow I can add this code:
<div class="duration"> <?php echo tribe_events_event_schedule_details(); ?> </div>to the bottom of plugins/the-events-calendar/src/views/month/single-event.php however this also adds the times to the mobile view and makes it look very strange so I only need it in the desktop view and not the mobile view. this is way outside my expertise
January 14, 2016 at 8:45 am #1056076Brian
MemberHi,
Thanks for using our plugins. I can help out here, but I am limited in supporting customizations.
There is a WordPress function called wp_is_mobile() that could hide the times on mobile devices:
<div class="duration">
<?php
if ( ! wp_is_mobile() ) {
echo tribe_events_event_schedule_details();
}
?>
</div>
That will hide it if the script thinks it is a mobile device, which is usually a tablet or phone. (resizing the browser will not hide the content)
That might work better for you.
If not could you provide a link in a private reply and I can take a look and see if I have another suggestion.
Thanks
January 14, 2016 at 7:13 pm #1056315david
Participantdoesn’t seem to remove the times from mobile view
January 14, 2016 at 7:14 pm #1056317david
ParticipantThis reply is private.
January 14, 2016 at 8:35 pm #1056331david
ParticipantI am not a web guy but I have seen this page https://codex.wordpress.org/Function_Reference/wp_is_mobile
they don’t have a ! so I will try it without the ! see if that works
January 14, 2016 at 8:38 pm #1056333david
Participantnope removing the ! doesn’t even display the times
January 14, 2016 at 8:53 pm #1056334david
Participantif all else fails I can add it to the event title with a
<br>in between the title and times- although it does not look as goodand then on mobile use some css to hide the actual start + finish times from displaying. Not really what I am after as it looks bad- see 23rd Jan http://kidsmagicworld.com.au/events/2016-01/?reloaded=true it would be nice to have the start + end times all on 1 line a slightly smaller font
January 14, 2016 at 8:56 pm #1056335david
Participantactually if I do a
<br> and then <h6>10:00 am to 12:00 pm</h6>then it does what is needed I think I will look into having css hide times from the mobile view and this sorts it out- I’ll test to see what it looks like on mobile devices-
This reply was modified 10 years, 3 months ago by
david.
January 14, 2016 at 8:59 pm #1056337david
Participantbugger- in mobile view it displays the H tags so it displays
Crows Nest<br><h5>10:00 am to 12:00 pm</h5>close but no cigar- this is frustrating as all hell-
This reply was modified 10 years, 3 months ago by
david.
January 14, 2016 at 11:46 pm #1056361david
Participantif you can’t help with the above an alternative if you could show me how is to create a custom field (a text line) and then how to echo that into the month view under the title but I forsee that the mobile view will show it on the calndar
January 15, 2016 at 7:44 am #1056648Brian
MemberOh I see you put it in the event title html tags.
I set it up like this:
" class="url">
And that would then only display under the title and not in the tooltip either.
January 15, 2016 at 11:24 pm #1056915david
Participantnot looking right
* */ ?> <div id="tribe-events-event-<?php echo esc_attr( $event_id ); ?>" class="<?php tribe_events_event_classes() ?>" data-tribejson='<?php echo esc_attr( tribe_events_template_data( $post ) ); ?>'> <h3><a>" class="url"><?php echo $title ?></a></h3> <div class="duration"> <?php echo tribe_events_event_schedule_details(); ?> </div> </div><!-- #tribe-events-event-# -->makes it look like this screen shot. I an not sure how or where to add the code http://kidsmagicworld.com.au/wp-content/uploads/2016/01/calno.jpg
January 15, 2016 at 11:28 pm #1056917david
Participanthere is a screen shot of the code http://kidsmagicworld.com.au/wp-content/uploads/2016/01/thecodescreenshot.jpg and the plugins/the-events-calendar/src/views/month/single-event.php page doesn’t work like this
January 16, 2016 at 12:05 am #1056918david
Participantthe following code added to the functions file adds the start time- is there a way of expanding this code to also show the end time?
/* * Adds start time to event titles in Month view */ function tribe_add_start_time_to_event_title ( $post_title, $post_id ) { if ( !tribe_is_event($post_id) ) return $post_title; // Checks if it is the month view, modify this line to apply to more views if ( !tribe_is_month() ) return $post_title; $event_start_time = tribe_get_start_time( $post_id ); if ( !empty( $event_start_time ) ) { $post_title = $event_start_time . ' - ' . $post_title; } return $post_title; } add_filter( 'the_title', 'tribe_add_start_time_to_event_title', 100, 2 ); -
This reply was modified 10 years, 3 months ago by
-
AuthorPosts
- The topic ‘add start and end time to month view under title’ is closed to new replies.
