WordPress.org

Forums

Events Manager
[resolved] custom events page without echoing the_content() (6 posts)

  1. cawo88
    Member
    Posted 1 year ago #

    I want to make a custom event template without echoing the_content(); / CONTENTS shortcode.

    I have this bit of code on my page.php
    if ( is_page('events') ){ include( TEMPLATEPATH .'/includes/events.php' );

    and on my includes/events.php file this is my code

    <div class="featured-event clearfix">
    	      <h1>Featured event</h1>
    	      	<?php
          		    $args = array('order' => 'DESC','limit' => 1,'category' =>'12','scope'=>'future, past');
                    $EM_Events = EM_Events::get($args);
                    foreach ( $EM_Events as $EM_Event):
          	    ?>
    
            <div class="featured-image"><?php echo $EM_Event->output('#_EVENTIMAGE'); ?></div>
                <article>
                    <h4><?php echo $EM_Event->output('#_EVENTDATES'); ?></h4>
                    <h4><?php echo $EM_Event->output('#_EVENTTIMES'); ?></h4>
    
          			<h4><?php echo $EM_Event->output('#_LOCATIONADDRESS'); ?></h4>
                    <h4><?php echo $EM_Event->output('#_ATT{Sign up}{No sign up required|Sign up required}'); ?></h4>
                    <h4><?php echo $EM_Event->output('#_ATT{Cost}{FREE}'); ?></h4>
    
                    <?php echo $EM_Event->output('#_EVENTNOTES'); ?>
                </article>
                <button><a href="<?php echo $EM_Event->output('#_EVENTURL'); ?>">Sign up</a></button>
                 <?php endforeach; ?>
    	</div> <!-- end .featured-event -->
    
        <?php if (class_exists('EM_Events')) {
              echo EM_Events::output( array('order' => 'DESC','scope'=>'past, future','pagination'=>1,'limit'=>'6') );
        } ?>

    I also have a single-event.php file with this bit of code

    <?php get_header();?>
    <section class="main clearfix">
           	<div class="event-detailed clearfix">
       	        <?php global $EM_Event;
                        echo $EM_Event->output_single();
                    ?>
    </section>
    <?php get_footer();?>

    I formatted the Default event list format and Single Event Page in WP Events Manager Admin settings and have set Display events as - Posts.

    If I don't put a post loop on my page.php file then the permalink is broken for my-booking, location, categories, tags sub pages and I also want to show Events Manager Search function.
    e.g. no

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    		<?php the_content(); ?>
      <?php>

    Can I not use the shortcode CONTENTS and make a custom events page

    I've read through these documentations but I find them difficult to understand and not sure if it is doing what I want to achieve.
    - http://wp-events-plugin.com/tutorials/create-custom-event-information-pages/
    - http://wp-events-plugin.com/tutorials/overriding-event-page-content-with-filters/
    - http://wp-events-plugin.com/documentation/using-template-files/

  2. angelo
    NetWebLogic Support
    Posted 1 year ago #

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    haven't tested this one myself, but I'm guessing this'd work:

    http://pastebin.com/9fWRczEc

    I created this one for a category page, which I think may work better if ported to work - http://pastebin.com/MSe9SvBq - by that i mean use get_queried_object() and pass that onto em_get_event() directly to get an EM_Event object.

  4. cawo88
    Member
    Posted 1 year ago #

    cool thanks for the replies guys.

    Sorry but I worded my question really bad. What I should've said is how to fix broken urls for the following pages... my-bookings, locations, categories, tags

    I have a custom WordPress theme and if I don't put a post loop in page.php e.g.

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<?php the_content(); ?>
    <?php endwhile; ?>

    then my-bookings, locations, categories, tags pages are blank. I thought since the the post is echoing the_content();. Maybe I could echo the content manually on page.php?

    I already have single-event.php</e> and it is displaying everything correctly but just can't get my-bookings page showing after clicking Manage my bookings link and Search functionality working.

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    that's odd, but I'm guessing it's either something in your theme (most likely) or another plugin that's overriding our code because normally this works.

  6. cawo88
    Member
    Posted 1 year ago #

    cool. thanks for the advice. I sorted the issue now it had something to do my custom theme.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic