Help needed with Events+ custom template

Hi,

Because the Events+ shortcodes don't retrieve the details that I needed, dont retrieve all of the events, or display the events in the right sequence, I had to create a custom template to try and do what I needed.

What I have so far is ugly, and I desperately need help.

http://174.122.174.219/~yoga/events/training-events/

If you take a look at the page above, the first section of the events displayed comes from the default custom template that I copied and renamed, putting it in the theme directory.

The second part (which looks like a series of cards, one for each event) comes from me cutting and pasting the following section of code from the single-page.php file from the theme (Elegant Theme's Lucid).

<div id="content-area" class="clearfix">
<div id="left-area">
<?php get_template_part('includes/breadcrumbs', 'page'); ?>
<?php get_template_part('loop', 'page'); ?>
<?php if ( 'on' == et_get_option('lucid_show_pagescomments') ) comments_template('', true); ?>
</div> <!-- end #left-area -->
</div> <!-- end #content-area -->

What I'd really like to be able to do is to have a combination of the two, with the following details from the first area being included in the 'cards':

- link to view event
- event date details
- event address details

If there is a featured image, I'd also like to be able to position a thumbnail in the top right-hand corner of the card.

Any ideas?

Thanks in advance,

Robert Ford

  • aecnu

    Greetings Robert Ford,

    Thank you for the custom coding question and though it is certainly beyond the scope of the support we provide here as clearly indicated by my direct inline Boss and the WPMU DEV lead developer himself, we do try to help if we can and would certainly not withhold the answer if we have it.

    With that said, I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Vladislav

    Hello,

    Going by the code you pasted in the opening comment, you will also have to copy the contents of your loop template (probably named "loop-page.php") and replace the line

    get_template_part('loop', 'page');

    with the contents of that file. This is where the "cards" are actually created. Once we have this in place, we can use the Events templating to populate the required areas (titles, dates, contents etc) with Events data.

  • fordrm

    Hi Vladislav,

    Thanks for getting back to me so promptly.

    I've cut and pasted that code into the template, but I'm stuck as to what to do next. I thought that maybe I should be looking for the function the_content() and then edit that to add the fields, but I can't seem to find it.

    Any help to point me in the right direction would be greatly appreciated!

    Thanks!

    Robert

    <?php
    global $booking, $wpdb, $wp_query;
    get_header( 'event' );
    ?>
    <div id="event-template-header">
    <h2>Level I Teacher Intensive</h2>
    This training program qualifies yoga teachers to safely and effectively impart rigorously researched yoga practices, with individually-tailored modifications, to those with arthritis and its related conditions.
    
    Yoga teachers who successfully complete this course will receive a certificate of completion, student and teacher manuals for implementing Yoga for Arthritis, a 16-class structure, in their local communities and access to an online community devoted to Yoga for Arthritis intensive graduates. Completion also qualifies a participant for up to 30 hours of Yoga Alliance credit.</br></br>
    <h2>Refresher Course</h2>
    The Level I Course is a prerequisite for this course. After you complete your first refresher course, you are eligible to be a Certified Yoga for Arthritis teacher.  Certified teachers must stay current by attending a refresher course every 3 years.</br></br>
    </div>
    	<div id="primary">
    		<div id="content" role="main">
                <div id="wpmudevevents-wrapper">
                    <h2><?php _e('Upcoming Courses', Eab_EventsHub::TEXT_DOMAIN); ?></h2>
                    </br></br>
                    <?php if ( !have_posts() ) : ?>
                        <p><?php $event_ptype = get_post_type_object( 'incsub_event' ); echo $event_ptype->labels->not_found; ?></p>
                    <?php else: ?>
                        <div class="wpmudevevents-list">
    
                        <?php while ( have_posts() ) : the_post(); ?>
                            <div class="event <?php echo Eab_Template::get_status_class($post); ?>">
                                <div class="wpmudevevents-header">
                                    <h4><?php echo Eab_Template::get_event_link($post); ?></h4>
                                    <a href="<?php the_permalink(); ?>" class="wpmudevevents-viewevent"><?php _e('View event', Eab_EventsHub::TEXT_DOMAIN); ?></a>
                                </div>
                                <?php
                                    echo Eab_Template::get_event_details($post);
                                ?>
                                <?php
                                    echo Eab_Template::get_rsvp_form($post);
                                ?>
                                </br></br>
                            </div>
                        <?php endwhile; ?>
                        </div>
                    <?php endif; ?>
                </div>
    		</div>
    	</div>
    <div id="content-area" class="clearfix">
    	<div id="left-area">
    		<?php get_template_part('includes/breadcrumbs', 'page'); ?>
    		<strong><?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<article id="post-<?php the_ID(); ?>" <?php post_class('entry clearfix'); ?>>
    		<?php
    			$thumb = '';
    			$width = apply_filters('et_blog_image_width',630);
    			$height = apply_filters('et_blog_image_height',210);
    			$classtext = '';
    			$titletext = get_the_title();
    			$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Singleimage');
    			$thumb = $thumbnail["thumb"];
    		?>
    		<?php if ( '' != $thumb && 'on' == et_get_option('lucid_page_thumbnails') ) { ?>
    			<div class="post-thumbnail">
    				<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
    			</div> 	<!-- end .post-thumbnail -->
    		<?php } ?>
    
    		<div class="post_content clearfix">
    			<h4 class="title"><?php the_title(); ?></h4>
    
    			<?php the_content(); ?>
    			<?php wp_link_pages(array('before' => '<p><strong>'.esc_attr__('Pages','Lucid').':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    			<?php edit_post_link(esc_attr__('Edit this page','Lucid')); ?>
    		</div> 	<!-- end .post_content -->
    	</article> <!-- end .entry -->
    <?php endwhile; // end of the loop. ?></strong>
    		<?php if ( 'on' == et_get_option('lucid_show_pagescomments') ) comments_template('', true); ?>
    
    	</div> <!-- end #left-area -->
    </div> 	<!-- end #content-area -->
    <?php get_footer( 'event' ); ?>
  • Vladislav

    Hello,

    To get the formatted address output, you can use the direct model call. If you don't already have an event model instance, you can create it like so:

    <?php $event = new Eab_EventModel($post); ?>

    Once that's done, you can request the address like this:

    <?php echo $event->get_venue_location(Eab_EventModel::VENUE_AS_ADDRESS); ?>

    Similarly, to get the event map (if you also have the Google Maps plugin installed), you can do this:

    <?php echo $event->get_venue_location(Eab_EventModel::VENUE_AS_MAP); ?>

    To actually move the address from where it is now to a different location, you'll need to also echo out the other bits of info yourself, instead of using "get_event_details" template method. The template class comes with helper methods to help you with this - but you can pretty much just go with the code already in the "get_event_details" method, just copy it to the template and move it around a bit to serve your purpose. It is located in the file "lib/class_eab_template.php", around line 476.

  • aecnu

    Greetings Robert,

    Thank you for letting us know and it appears this particular topic is now resolved/closed, if you need any further assistance please let us know.

    If it wasn't resolved, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Thank you for being a WPMU Dev Community Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.