Support » Plugin: Events Manager » Events Manager pages ‘CONTENTS’ hook not working with Twenty Twenty-two theme

  • WordPress 6.0
    Events Manager 5.12.1
    Twenty Twenty-two theme

    The ‘CONTENTS’ text in designated Events Manager pages isn’t pulling in the formatted EM layout while using the Twenty Twenty-two theme even with all all other plugins deactivated and gutenberg editor disabled.
    Everything worked fine when switching to Twenty Seventeen theme.

    Under ‘Pages >> Event List/Archives >> Events page:
    – The ‘Events page’ is set to this page: https://wp.times-up.org/calendar
    – ‘Override with Formats?’ is set to ‘yes’

    Using a EM shortcode works, but then we’re missing all the potential custom formatting. This page uses a shortcode: https://wp.times-up.org/calendar/categories

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 25 total)
  • I have the exact same problem. If you found a solution, please be so kind to share it here! Thanks 🙂

    Same for me, any help regarding it>

    I also have this issue. All plugins deactivated, and the only thing that worked was switching to TwentyTwentyOne (not a block theme).

    However, you can still use the shortcodes, so you can replace the CONTENT with whichever shortcode you want: https://wp-events-plugin.com/documentation/shortcodes/

    Thread Starter roger995

    (@roger995)

    I’m changing the problem example page to https://wp.times-up.org/calendar/locations
    Need to get things working with a shortcode for the initial example page (https://wp.times-up.org/calendar)

    I’m still trying to troubleshoot this, because I have one installation that it seems to be working, and I can’t reproduce the working site.

    But, I did find some notes that might be helpful:

    (1) This error description sounds REALLY similar and is failing on CPT single pages: https://core.trac.wordpress.org/ticket/54896#comment:9

    (2) This is the recommended alternate function to the add_filter( 'single_template',...: https://developer.wordpress.org/reference/hooks/type_template_hierarchy/

    This plugin does not yet seem to actually be compatible with TwentyTwentyTwo/block themes.

    Thread Starter roger995

    (@roger995)

    Fwiw, meanwhile still using Twenty Twenty-two theme I was able to manage a fair amount of formatting for a vertical events listing with this short code:

    [events_list limit=”20″ pagination=”1″]<div class=”event-list-view-item”><span class=”event-list-item-title”>#_EVENTLINK</span>, #_EVENTDATES #_EVENTTIMES #_LOCATIONLINK<div class=”event-list-item-desc”>#_EVENTEXCERPT{30,…}</div></div>[/events_list]

    This is the page https://wp.times-up.org/calendar/calendar-list-view

    Used info from this documentation:
    https://wp-events-plugin.com/documentation/shortcodes
    https://wp-events-plugin.com/documentation/event-search-attributes/

    Update: WORKING***

    On line 40 of em-location-post.php and line 63 of em-event-post.php, change

    $post_templates = array('page.php','index.php');

    to

    $post_templates = array('page.php','index.html');

    and then the template loader will return a correct template when you have events displaying as a Page.

    Maybe this Class/function Em_Event_Post public static function single_template($template){... and the Class/fucntion Em_Location_Post public static function single_template($template){... can be hooked in a child theme for 2022?

    But, it works.

    Edit: the WSOD is because index.php DOES exist in block themes, but is blank.

    • This reply was modified 4 months, 2 weeks ago by chenryahts. Reason: note

    Improved version that will actually use the **selected** block editor templates:

    (This is almost the same function for both the Events and Locations like described above. This is the events version.)

    	/**
    	 * Overrides the default post format of an event and can display an event as a page, which uses the page.php template.
    	 * @param string $template
    	 * @return string
    	 */
    	public static function single_template($template){
    		global $post;
    		if( !locate_template('single-'.EM_POST_TYPE_EVENT.'.php') && $post->post_type == EM_POST_TYPE_EVENT ){
    			//do we have a default template to choose for events?
    			if( get_option('dbem_cp_events_template') == 'page' ){
    				$post_templates = array('page.html','index.html');
    			}else{
    			    $post_templates = array(get_option('dbem_cp_events_template'));
    			}
    			if( !empty($post_templates) ){
    			    $post_template = locate_template($post_templates,false);
    			    if( !empty($post_template) ){ $template = $post_template;
    				}else{
    					$post_template = locate_block_template( STYLESHEETPATH . '/templates/', EM_POST_TYPE_EVENT, $post_templates);
    					if( !empty($post_template) ) $template = $post_template;
    				}
    			}
    		}
    		return $template;
    	}

    The locate_template function will NEVER look in the right folder for block template files.

    @chenryahts that looks great !!!
    Is this something we need to patch into the plugin source code (until a new version is hopefully published), or can it be inserted into the WP engine through Code Snippets ? (Code Snippets plugin)

    @palijn,

    Thanks, I’ve currently got it patched, but not on a production site.

    I think it has to be fixed in the plugin itself, otherwise you’d have to Extend the class, and then use the new class every where (e.g. not an easy fix, I think).

    Hopefully they update it soon, fingers crossed.

    @chenryahts thanks !
    I just patched the em-event-post.php . Single events are properly displayed now : great job !!

    Should your patch fix the display of the default “Events” page ? Because as such the only contents I get on those is “CONTENTS” .

    @palijn When you select the page to use for the events page, then go to the editor for that page and choose the template. The archive page isn’t /really/ managed by the Events Manager Plugin, so it isn’t even trying to select that template (as far as I could tell).

    Hopefully that helps

    @chenryahts okay I’m lost there. If you may help ?

    In the Event Manager Settings, “Pages” tab, “Event Lists/Archives” section, there is a “Page of events” setting with a drop-down of available Pages, in which the “Events” page is selected. (I think it was the default setup and I never changed it).
    That page does not contain anything but its title and a paragraph (classic editor) with the text “CONTENTS”. The template for this page (of the 2022 theme) is the default template for Page. The slug of the page is /evenements while the events archive page slug is /agenda (as per the Event Manager settings area, right below the famous page selection dropdown).

    The problematic page is there : https://ethiqueetchiens.fr/evenement/
    This “Events” page used to display a list of events, but now it only display the page title and the “CONTENTS” text.

    As you can guess, I am totally lost now and have no clue how to get the old behavior of this particular events page back. Any idea ?

    It seems like you are trying the 2 different archive pages (different slugs for each?), and maybe it will work like that, but IDK.

    I’ve got the archives off, and am only using the events archive.

    I think the plugin will only overwrite the page that is SET as the Events page, the archive page is programmatic. Maybe try setting both instances to the page you want to use and try it.

    I hope that helps.

    So, not working.

    I disabled the “WordPress archives” option that was using the /agenda slug.
    There is one page named “Evenements” that is SET in the preferences as you said. I tried to modified its slug to /agenda , too. I selected another page then again the “Evenements” page, in case the selection needed to be re-registered.

    Nothing works : this page still displays “CONTENTS” instead of an event list.

    I appreciate you are trying to help ! Any ideas ?

Viewing 15 replies - 1 through 15 (of 25 total)
  • You must be logged in to reply to this topic.