• Resolved cawo88

    (@cawo88)


    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.
    https://wp-events-plugin.com/tutorials/create-custom-event-information-pages/
    https://wp-events-plugin.com/tutorials/overriding-event-page-content-with-filters/
    https://wp-events-plugin.com/documentation/using-template-files/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

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

    https://pastebin.com/9fWRczEc

    I created this one for a category page, which I think may work better if ported to work – https://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.

    Thread Starter cawo88

    (@cawo88)

    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.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    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.

    Thread Starter cawo88

    (@cawo88)

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘custom events page without echoing the_content()’ is closed to new replies.