Home › Forums › Calendar Products › Events Calendar PRO › Inserting Title and Text above each View
- This topic has 6 replies, 3 voices, and was last updated 9 years, 1 month ago by Geoff.
-
AuthorPosts
-
February 28, 2015 at 4:13 am #945290LarsParticipant
Hi,
In order to do a simple thing as writing a bit of heading and informative text above our calendar, we need to deal with this ugly script. Why is everything so complicated with TEC?
We need to compile these scripts into 1 script that will display the same Title and Text on Month View, List View, Map View and Day View.
// Custom Events Month View Title add_filter( 'tribe_get_events_title', 'change_month_view_title', 15 ); function change_month_view_title( $title ) { $look_for = 'Events for October 2015'; if ( false === strpos( $title, $look_for ) ) return $title; return 'Calendar of Events for Danish Maritime Days – 5- 9 October 2015'; } // Custom Events Month View Text add_action( 'tribe_events_after_the_title', 'add_text_below_month_title' ); function add_text_below_month_title() { if ( ! tribe_is_month() ) return; echo '<p>The calendar is continuously updated with new events. Check back often to plan your personal schedule during Danish Maritime Days. All stakeholders in the global maritime industry are invited to host events as part of Danish Maritime Days. For more information on how to join the platform, please click here.</p>'; } // Custom Events List View Title add_filter( 'tribe_get_events_title', 'change_list_view_title', 15 ); function change_list_view_title( $title ) { $look_for = 'Upcoming Events'; if ( false === strpos( $title, $look_for ) ) return $title; return 'Calendar of Events for Danish Maritime Days – 5- 9 October 2015'; } // Custom Events List View Text add_action( 'tribe_events_after_the_title', 'add_text_below_list_title' ); function add_text_below_list_title() { if ( ! tribe_is_list_view() ) return; echo '<p>The calendar is continuously updated with new events. Check back often to plan your personal schedule during Danish Maritime Days. All stakeholders in the global maritime industry are invited to host events as part of Danish Maritime Days. For more information on how to join the platform, please click here.</p>'; }
March 1, 2015 at 5:08 am #945336LarsParticipantOriginal support thread:
https://theeventscalendar.com/support/forums/topic/custom-list-title-and-text/March 2, 2015 at 7:54 am #945461GeoffMemberHi there, Lars!
It looks like you could actually combine all of those scripts into a single action and use the conditional statements to hook into each view rather than split them up the way you have here. That would certainly be a more efficient route.
Why is everything so complicated with TEC?
I’m not quite sure what you mean here. The plugin does offer a very simple solution for adding content to the templates globally, but targeting specific views certainly does require some custom work. While I certainly agree that creating custom solutions for custom circumstances is a rather arduous task, I think that comes with the territory when crossing into custom development. From that perspective, I think the claim that “everything” is complicated is a tad bit harsh and unfair given that we do provide solutions.
Cheers!
GeoffMarch 2, 2015 at 9:24 am #945497VictoriaParticipantYeah! Why can’t I just click a button and have ECP use all the data from my neural link and just rearrange everything EXACTLY the way I want/need it, instantly – without all this overly-complicated “code” stuff? Code. Templates. Views. That stuff just gets in the way!
/sarcasm
March 2, 2015 at 3:32 pm #945585LarsParticipantOk, so how would we combine the scripts and how do we target Day and Map View?
@Raymond: Webflow.com is a proper example of how you can build a whole website using proper UX, drag’n’drop items and unlimited configuration possibilities. Things are possible with the right tools.
@Geoff: As stated in previous threads if The Events Calendar would only support “shortcodes”, calendars and even separate views could be inserted into single WordPress pages, giving all of us the simple possibility to write a page header, a simple introduction text and choose to add Widget sidebar or not. General things, for general purposes. With the Events Calendar it’s “one size fits all” – or you have to be a skilled developer and code scripts to do what WordPress always did easily.March 3, 2015 at 7:24 am #945668VictoriaParticipantOh, but it’s supposed to be MUCH colder tomorrow.
My point, in case you missed it, is that some drag-n-drop page layout tool has absolutely nothing to do with customizing WordPress plugins.
March 3, 2015 at 8:31 pm #945811GeoffMemberHowdy folks! I’m certainly glad that we’re able to discuss issues in an open dialogue like this, but am afraid we’re getting a little off course and want to encourage the conversation to stay on a positive note.
Lars, the suggestion here is to take all the conditional statements you’ve made in each action and combine them into a single action. That way you have one filter and one action that targets multiple conditions. Here’s a nice example of how that works in a similar snippet.
I also do want to point out that The Events Calendar does in fact support a shortcode to embed the Mini Calendar widget: [tribe_mini_calendar]. We’re working on including others, but don’t have a specific timeframe for when those will be released. In the meantime, you might find the shortcodes offered in the Event Rocket plugin (not support by us here in the forums) a handy solution.
I hope you find these tips and suggestions helpful and that they point you in the right direction. I’m afraid this is as far as we can support this level of custom development, so I’m going to go ahead and close this thread. Best of luck!
Geoff
-
AuthorPosts
- The topic ‘Inserting Title and Text above each View’ is closed to new replies.