• Newbie here, but I created a list of events and they have a permalink which leads to site.com/events/event-title, I have an events.php custom template for /events, do I make a page with events.php as the parent?

    Simply put, slug is events, url given by am events is /events/event-title, where should the template file be and how do I extract the data based on the url.

    Thank you.

    https://wordpress.org/plugins/am-events/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Atte Moisio

    (@moisture)

    Hey,

    You could create a custom post type template

    So, when clicking the event permalink, WordPress will look for a template named single-am_event.php and if it is not found, it will use the default single.php template.

    To display event specific information like the dates, venues, and event categories on the custom template, you can either use the template tags provided by the plugin (see Other Notes), or the functions provided by WordPress for getting data from custom fields like get_post_meta.

    Hope that helped!

    Thread Starter MisterDrB

    (@misterdrb)

    That helped a little bit! Making progress for sure thank you!

    I set this up in the functions.php

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    	register_post_type( 'am_event',
    		array(
    			'labels' => array(
    				'name' => __( 'Events' ),
    				'singular_name' => __( 'am_event' )
    			),
    		'public' => true,
    		'has_archive' => true,
    		)
    	);
    }

    and I have single-am_event.php, which now displays the event details when the url is site.com/am_event/{event_name} , but I can’t find a way to change it to site.com/events/{event_name}, even though the slug I have in the settings is set to “events”. Care to explain what I’m overlooking here?

    Plugin Author Atte Moisio

    (@moisture)

    You don’t need to register the am_event post type in functions.php. It is done by the plugin already 🙂

    Have you tried resetting the permalinks after changing the slug? In admin panel, go to Settings > Permalinks and press ‘Save Changes’. It should work after that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Displaying single event details’ is closed to new replies.