Home › Forums › Calendar Products › Events Calendar PRO › Creating Home Page 'list' view vs Events Page 'list' view
- This topic has 6 replies, 3 voices, and was last updated 9 years, 6 months ago by
Lucy.
-
AuthorPosts
-
October 17, 2016 at 11:00 am #1177788
Lucy
ParticipantHi there,
I’ve been working with TEC Pro plugin for a couple days now and have been following along the Themer’s Guide https://theeventscalendar.com/knowledgebase/themers-guide/ to create custom templates.
An issue I’ve currently run into though, is how to create a new view template. I need a ‘list’ view for the Home Page that varies slightly from the ‘list’ view on the Events Page. I’ve tried to create a duplicate of the list view with:
/wp-content/themes/[my-theme]/tribe-events/home/ (including the same content as /list/)
and
/wp-content/themes/[my-theme]/tribe-events/home-list.php/with the shortcode
[tribe_events view="home"]in my front-page.php to differentiate from list.php that the events page ‘Default view’ is set to. However, I’m not having any luck.Am I missing a step here/can this be done?
Thanks for your help!
October 18, 2016 at 8:48 am #1178354Andras
KeymasterHi Lucy
Thanks for going Pro and welcome to the forums! Let me help you with your question.
I’m not quite sure the creating a home directory will work like that.
If you would like your website’s home page to show a calendar, then create an empty page and put the shortcode in there. I can recommend this article for some further details:
Let me know if this helps or if you have any more questions.
Cheers,
AndrasOctober 18, 2016 at 9:35 am #1178471Lucy
ParticipantHi Andras,
I already have the shortcode on my Home Page (myurl.com) – the problem is that it’s identical to the Events Page list (myurl.com/events/).
I’d like these templates to be structured differently, so I’m wondering if I can create create a new view/list template?
For example:
On the Home Page list I want the event date to display: November 14
On the Events Page list I want the event date to display: Monday, November 14th, 2016October 19, 2016 at 9:13 am #1179107Andras
KeymasterHi Lucy,
Achieving that would require customization work, which we are limited in supporting and currently our hands are full.
What you can try is overriding the existing templates, like tribe-events/list.php and adding a conditionals like ‘if ( is_home() )’ to change the behavior based on where the view is embedded.
If you need some expert help I can share with you this list of awesome people of the community who could help you out with this:
https://theeventscalendar.com/knowledgebase/find-a-customizer/
I hope this helps to get you started.
Cheers,
AndrasOctober 19, 2016 at 11:28 am #1179302Lucy
ParticipantHi Andras,
Sounds good, for those following this thread:
– I’m copying the contents of tribe-events/list/ into tribe-events/list.php and wrapping the duplicated content in a conditional (to adjust).
<!-- Main Events Content - Home Page --> <?php if ( is_front_page() ) { ?> <?php tribe_get_template_part( 'list/content' ); ?> <?php } ?> <!-- Main Events Content - Custom Page --> <?php if ( !is_front_page() ) { ?> <!-- Duplicated contents of tribe-events/list/ to customize --> <?php } ?>Thanks!
-
This reply was modified 9 years, 6 months ago by
Lucy.
October 20, 2016 at 8:42 am #1179830Andras
KeymasterHey Lucy,
Thanks for sharing your solution here, much appreciated!
Allow me to recommend a simplification:
<!-- Main Events Content - Home Page -->
<?php if ( is_front_page() ) {
php tribe_get_template_part( 'list/content' );
}
// Main Events Content - Custom Page
else {
// Duplicated contents of tribe-events/list/ to customize
} ?>Not much of a difference, but performance wise a bit better to have if … else … than if … if …
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic in the forum and we will help you out.
Good luck with your project!
Cheers,
AndrasPS: If you like our plugin, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
https://wordpress.org/support/view/plugin-reviews/the-events-calendarPS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!
-
This reply was modified 9 years, 6 months ago by
-
AuthorPosts
- The topic ‘Creating Home Page 'list' view vs Events Page 'list' view’ is closed to new replies.
