Home › Forums › Calendar Products › Community Events › Only show excerpt on specific page
- This topic has 3 replies, 2 voices, and was last updated 10 years, 1 month ago by
Geoff B..
-
AuthorPosts
-
March 14, 2016 at 8:37 am #1088478
Melanie Adcock
ParticipantI am redoing a clients site using TEC with ET Plus and Woocommerce. Works like a dream. I have one issue. My client has a CPR events landing page that has rich SEO that drives most of his sales from google searches. He used to have a manual list of classes with paypal buttons. With the new set up he wants the events list to be under the content on that page as well as on the main events page. Since I am using Genesis I figure the best way to do this was:
1. Create a widget area after the content area on the page.
2. Use the Event List Widget in that Widget Area.
3. Configure the Event List Widget to show Excerpt and Read More link. (done- have the override files in my theme folder.).I only want the excerpt and read more link to show on that page. The page ID is 97.
I am not sure how to write that.<div class=”tribe-event-widget-content”>
<?php the_excerpt(); ?>
<span class=”eventbutton”>” title=”<?php the_title(); ?>”>Buy Tickets</span>
</div>-
This topic was modified 10 years, 1 month ago by
Melanie Adcock.
-
This topic was modified 10 years, 1 month ago by
Geoff B..
March 14, 2016 at 9:02 pm #1088908Geoff B.
MemberGood evening Melanie and welcome back!
Thank you for reaching out to us. I think you have the right approach to solving this client’s needs.
I would love to try to help you with this topic.But, just to set expectations, as you might know, the scope of our support is mostly to get our wonderful customers started on the right track to customize their site and to help them in case of issues. We unfortunately do not provide complete support for customization.
With that in mind, I believe it’s a simple matter of using the correct functions and code structure:
- Instead of using the_excerpt, I would recommend using tribe_events_get_the_excerpt: https://theeventscalendar.com/function/tribe_events_get_the_excerpt/
- Same thing with the_title , there are 2 other more specific functions: https://theeventscalendar.com/function/tribe_get_events_title/ and https://theeventscalendar.com/function/tribe_events_title/
Finally, I would study very closely how the List view is being coded for inspiration (since it already provides the title and the read more link).
Let me know how that goes.
Best regards,
Geoff B.March 15, 2016 at 8:55 am #1089101Melanie Adcock
ParticipantI actually figure it out after sleeping on it. Woke up with the answer. For others wanting to add the events to a page after the content this is what I did (I use Genesis). I didn’t want to reinvent the wheel and I knew I could add the excerpt to the widget and then make it conditional to a specific page thus avoiding a custom page template. I copied the needed tribe-events files to my theme folder following the Themer’s Guide.
1. Added the tribe_events_get_excerpt to the widget list view (widget-list.php) and made it conditional to the page I wanted it to appear on. 97 is the ID of the page. This was on line 56 on the list-widget.php.
<?php if(is_page(97)) { ?> <div class="tribe-event-widget-content"> <?php the_excerpt(); ?> <span class="eventbutton"><a href="<?php echo esc_url( tribe_get_event_link() ); ?>" class="tribe-events-read-more" rel="bookmark"><?php esc_html_e( 'Buy Tickets', 'the-events-calendar' ) ?> »</a></span> </div> <?php } ?>2. Created a custom widget area for that page by adding this to the functions.php file.
// Register openclass page widget area genesis_register_sidebar( array( 'id' => 'openclass-page-sidebar', 'name' => 'Open Class Page Events', 'description' => 'These are events at the bottom of the page.', ) );3. Added the sidebar to the page after the content using a hook in the functions.php file.
//* Add the page widget in the content - HTML5 - for the event list add_action( 'genesis_after_entry_content', 'mga_add_page_content' ); function mga_add_page_content() { if ( is_page(97) ) genesis_widget_area ('openclass-page-sidebar', array( 'before' => '<div class=“openclass”><div class="wrap">', 'after' => '</div></div>', ) ); }4. Added the List Widget to the new sidebar under Appearance > Widgets.
5. Styled the button with css.Worked perfectly http://gacpr.melanieadcockdevsites.com/openclass/
I even create a custom sidebar for the event page and single events and added that to the default page template.
March 15, 2016 at 9:23 am #1089123Geoff B.
MemberGood afternoon Melanie,
That is awesome work, really! Kudos and thank you for sharing for everybody’s benefit.
You are welcome back on our support forums any time 🙂
For now, I am going to close this thread.
Have a great week!
Geoff B.
-
This topic was modified 10 years, 1 month ago by
-
AuthorPosts
- The topic ‘Only show excerpt on specific page’ is closed to new replies.
