• Resolved gabelloyd

    (@alwaysbrightblue)


    Feel free to link me to an already solved related question. I’ve been Googling this for hours because I know I can’t be the only person that wants to do this.

    On my front page, I basically want to copy the function of the “Upcoming Events” widget into a non-widgetized area. My front page is not an Events Page, so I need to call EM, which I know I’m kind of doing because my fallbacks seem to know if there is an event or not. I’ve read this article a few times: http://wp-events-plugin.com/tutorials/create-custom-event-information-pages/ as well as the em_content documentation, but I’m not able to echo the title, date, location of the next upcoming event.

    Test Project link: http://nca.glidecreative.us/

    I have a few fallbacks for the content (this is a mash-up in the Responsive WP theme). I’ve copied what I think is relevant code below.

    <?php
    $events_count = EM_Events::count( apply_filters('em_content_events_args', $args) );
    //$EM_Location = get_em_location();  http://wordpress.org/support/topic/single-location-page-title-name-town?replies=4
    get_header(); ?>
    
    <div id="content-full" class="grid col-940">
    <div class="grid col-460">
    
                <?php $options = get_option('responsive_theme_options');
    			// First let's check if headline was set
    			    if ($options['home_headline']) {
                        echo '<h1 class="featured-title">';
    				    echo $options['home_headline'];
    				    echo '</h1>';
    			// but if we have an upcoming event we'll display the upcoming event name
    				} elseif ($events_count > 0) {
    					echo '<h1 class="featured-title">';
    					echo '_#EVENTNAME'; //doesn\'t work because not an event page
    					echo '</h1>';
    			// If not display default headline
    			      } else {
    			        echo '<h1 class="featured-title">';
    				    echo __('Title Lipsum','responsive');
    				    echo '</h1>';
    				  }
    			?>
    
                <?php $options = get_option('responsive_theme_options');
    			// First let's check if headline was set
    			    if ($options['home_subheadline']) {
                        echo '<h2 class="featured-subtitle">';
    				    echo $options['home_subheadline'];
    				    echo '</h2>'; 
    
    			// but if we have an upcoming event, we'll display the upcoming event date
    				} elseif ($events_count > 0) {
    					echo '<h2 class="featured-subtitle">';
    					echo '#_EVENTDATES'; //doesn\'t work because not an event page
    					echo '</h2>';
    			// If not display default tagline
    			      } else {
    			        echo '<h2 class="featured-subtitle">';
    				    echo __('subtitle lipsum','responsive');
    				    echo '</h2>';
    				  }
    			?>
    
                <?php $options = get_option('responsive_theme_options');
    			// First let's check if content is in place
    			    if (!empty($options['home_content_area'])) {
                        echo '<p id="cta-p">';
    					echo do_shortcode($options['home_content_area']);
    				    echo '</p>';
    			// but if there is an upcoming event, we show the event location.
    			      } elseif ($events_count > 0) {
    			        echo '<p id="cta-p">';
    				    echo '#_LOCATIONTOWN, #_LOCATIONSTATE'; //doesn\'t work because not an event page
    				    echo '</p>';
    
    			// If not let's show NCA blurb.
    			      } else {
    			        echo '<p id="cta-p">';
    				    echo __('lipsum','responsive');
    				    echo '</p>';
    				  }
    			?>
    
            </div><!-- end of .col-460 -->
    </div><!-- end of .col-940 -->
    <!--there is more to this page, but left out for this wp support question.-->
    ?>

    Thank you for your help. Sorry if this is a dumb question.

    http://wordpress.org/extend/plugins/events-manager/

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

    (@angelo_nwl)

    I basically want to copy the function of the “Upcoming Events” widget into a non-widgetized area.

    have you tried to use shortcode like [events_list scope=”future”] – http://wp-events-plugin.com/documentation/shortcodes/

    Thread Starter gabelloyd

    (@alwaysbrightblue)

    I didn’t, but it gives me an idea for a work around. I’ll give it a shot today and see if it works and let you know.

    Thread Starter gabelloyd

    (@alwaysbrightblue)

    I’m a little stuck. When I use this:

    echo do_shortcode('[events_list limit="1"]'.#_EVENTLINK.'[/events_list]');

    Everything after the ‘#’ is commented out. I’ve tried also running an echo the_content(); on the page and putting shortcode in the visual editor, but that didn’t quite work either. Suggestions?

    Try it like this:

    echo do_shortcode('[events_list limit="1"]#_EVENTLINK[/events_list]');

    Thread Starter gabelloyd

    (@alwaysbrightblue)

    Works!

    For anyone else, I made this a little more dynamic by showing this on the front page if there are upcoming events by counting the number of upcoming events with:

    $events = EM_Events::get($atts);
    $events_count = count ( $events );

    Then, before where you want the events content:

    if ($events_count > 0) { //your code }

    Thanks for you help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Call _#EVENTNAME on non-event page (front-page)’ is closed to new replies.