WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Single Event Page (18 posts)

  1. ooomes
    Member
    Posted 2 years ago #

    Hi,
    my setting for the events page is [No Event Page] and am using template tags to display future and past events in on of the pages. The event list works fine... shows all the events (both future and past) but when i click the event it does not go to its single page rather is 404.

    So i tried with copying the single-event.php file to my theme but no luck and then i tried copying all the templates in my theme inside plugins folder as mentioned in your documentation but again no luck.

    Any help will be great..

    Thanks!

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

  2. agelonwl
    Member
    Posted 2 years ago #

  3. ooomes
    Member
    Posted 2 years ago #

    no luck...

    let me explain my recent settings:

    I have a page for events called "Events" with custom WP template called "Events"
    - EM Settings:
    - Events Page -> Events
    - Show Events page in lists? -> No
    - Disable title rewriting? -> No

    And am using template tags in my event template "template-events.php" to show all the future events in one section and then all the past events in another section.

    The thing is that it is working but when i click on the listed event title to go to the detail page, nothing happens. I mean the URL changes to eg. http://abc.com/events/event/EVENT_TITLE but there is no detail rather shows the same list of Future and Past Events. Even i tried with define('EM_DISABLE_PERMALINKS', true); but still the same case, the url changes to http://abc.com/events/?event_id=8

    Please need some light...

    Thanks!

  4. agelonwl
    Member
    Posted 2 years ago #

    can you post your code on how you show future/past events.

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    do any single event pages work or is it just in your lists of past/Future events?

  6. ooomes
    Member
    Posted 2 years ago #

    Hi agelonwl,

    my code:

    <?php
    /* Template Name: Events */
    get_header(); the_post();
    ?>
    <!-- EOF Header -->
    
    	<div id="container">
    		<div class="page-content">
    
    			<div class="content-main events">
    				<h2>Events</h2>
    				<?php the_content(); ?>
    				<h3>Upcoming Events</h3>
    				<?php
    					if (class_exists('EM_Events')) {
    						echo EM_Events::output( array('limit'=>0,'scope'=>'future') );
    					}
    
    				?>
    				<h3>Past Events</h3>
    				<?php
    					if (class_exists('EM_Events')) {
    						echo EM_Events::output( array('limit'=>20,'scope'=>'past', 'pagination' => 1) );
    					}
    
    				?>
    
    			</div>
    			<?php get_sidebar(); ?>
    		</div>
    <?php get_footer(); ?>

    @Marcus:

    Hi Marcus, Regarding the above code, I get a list of all events because of the_content() function and get the past and future events list too and the single page works but keeps the Past and Future events lists at the bottom which i don't need on single page. Since i don't need the default list of events showing up due to the_content() function, i comment that wordpress function and just use the EM codes for past and future events then the single page does not work. The URL changes to http://SITE_URL/events/event/EVENT_NAME/ but the page stays same (Past and Future Events List) with no event detail content.

    Hope this explains my issue...

    Any help is highly appreciated.

    Thanks!

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    you should keep the_content as all pages are served from there.

    however, you can choose whether to show the future/past events by wrapping it in an if statement with a template tag like 'is_events_page()'

  8. ooomes
    Member
    Posted 2 years ago #

    Hi Marcus,

    do you mind providing an example snippet as reference to my code??

    Thanks!

  9. ooomes
    Member
    Posted 2 years ago #

    Hi,

    tried a lot of things but no luck...

    Any thoughts/suggestions on to achieve this will be a great help for me.

    The output hoping to get:

    Upcoming Events

      Upcoming Event Item 1
      Upcoming Event Item 2
      Upcoming Event Item 3

    Past Events

      Past Event Item 1
      Past Event Item 2
      Past Event Item 3

    Any new approach to achieve this along with working links when clicked on event title to view detail event??

    Thanks!

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    i suggest you read the docs and tutorials on our site

    http://wp-events-plugin.com/documentation/
    http://wp-events-plugin.com/tutorials/

    there's many ways to do this

  11. John Bueno
    Member
    Posted 2 years ago #

    Hey Marcus

    I am attempting to use the is_events_page() page to remove the events on the event single page however this function is throwing an error. Is it still supported? This is the method i am trying to use it in:

    if(is_events_page()){
    echo('true');
    }else{
    echo('false');
    }

    With debug turned on I am getting an undefined function error.

  12. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    should be em_is_events_page()

  13. John Bueno
    Member
    Posted 2 years ago #

    Thanks that is working for me. One last question. Is it possible to use:

    EM_Events::get(array());

    or something similar to create a custom single event page by passing it an argument that allows it only pull the single event?

    Right now my code looks something like this:

    if(em_is_events_page()){

    if (class_exists('EM_Events')) {
    $events = EM_Events::get(array('scope' => 'future', 'town'=>$location, 'category'=>$category ));

    foreach($events as $event) {
    if(date('n', $event->start) != $month) continue;
    parse_event($event, 'events', $i);

    }
    }
    }else{
    the_content();
    }

    and I am just placing the code in the event single section of the plugin settings.

  14. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    instead of EM_Events, use either

    $EM_Event = new EM_Event(id);

    or use

    $EM_Event = em_get_event(id);

    instead of grabbing many events and looping through them.

  15. John Bueno
    Member
    Posted 2 years ago #

    Thanks again Marcus this has been very helpful. I have one last question and then I should be all set. I am attempting to use the:

    $EM_Event = new EM_Event(id);

    function which requires an event ID to generate a custom event single page. Is there some type of get event id function that I can use to get the id when I am on the single page. At this point my url is.

    siteurl.com/events/event/event-name

    Thanks again!

  16. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    Hi, there’s two IDs, an event id, and a post id.

    You can use either one in shortcode.

    To find the post id, try editing an event, and look at the URL.

    If you’d like to view the event id, you can try using #_EVENTID in your event lists (sorry, need a better way to show that, will add soon). Another way is to view the bookings page, or edit the event front-end, and view the event_id=x in the url.

  17. John Bueno
    Member
    Posted 2 years ago #

    I managed to create my own even single page by grabbing the event slug from the end of my permalink and then using the wpdb function to get the corresponding event ID.

    $url = $_SERVER['REQUEST_URI'];
    	$eventSlug=end(explode("/", $url));
    	$eventID = $wpdb->get_results("SELECT event_id FROM wp_em_events WHERE event_slug = '".$eventSlug."'", OBJECT);
    	$EM_Event = new EM_Event($eventID[0]->event_id);

    One thing I am looking to do to finish up this up is to display the event image however I don't see it being stored in the event object anywhere. Is it possible to get this url using something similar to.

    <?php echo $EM_Event->get_categories()->categories[0]->name; ?>

  18. John Bueno
    Member
    Posted 2 years ago #

    Please disregard my last post. I found the image url in the event object.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic