EO_Theme_Compatabilty
since 3.0.0
Theme compatability class inspired by bbPress
When 'theme compatability' is enabled the plug-in does the following:
- Buffers the events loop for events pages (but not single.php)
- Forces the template to be page.php (or similar). The list of appropriate templates is
filterable.
- Uses the buffered event loop as the 'page' content.
- Adds eo-tc-page class to the body/page class
- Adds eo-tc-event class to each event
- Frontend stylesheet contains rules which reference eo-tc-page/eo-tc-event classes
Methods
protected |
#
__construct( )
|
public |
#
get_instance( )
|
public |
#
init( )
Starts the ball rolling
|
public |
#
add_filter( $filter, $priority, $accepted_args )
|
public |
#
remove_filter( $filter, $priority )
|
public |
#
highest_priority( $tag )
Given a tag returns the highest existing callback priority + 1
|
public |
#
setup_hooks( )
We set up our template_include callback, where most of the work is done.
We used the template_redirect template to add our callback as late as possible.
|
public |
#
template_include( $template )
Main body of the class. If theme compatability is enabled and it is an events page (not single event), and no appropriate template has been found we create a dummy post, and use the page.php template. The content of the dummy post is the events loop.
|
public |
#
get_theme_compat_templates( )
A list of templates that we will try to use (in the order they are attempted) This is filterable via eventorganiser_theme_compatability_templates
|
public |
#
post_class( $classes, $class, $post_id )
Injects 'eo-tc-event' class to events in theme compatabilty mode.
|
public |
#
body_class( $classes, $class )
Injects 'eo-tc-page' class to body in theme compatabilty mode.
|
public |
#
post_class_events_page( $classes, $class, $post_id )
Injects 'eo-tc-page' class to dummy post in theme compatabilty mode.
|
public |
#
replace_page_content( $content )
Ensure dummy page content is as we want it
|
public |
#
remove_content_filters( $query )
Removes all filters for the dummy page content May not be called, in which case we fallback on replace_page_content();
|
public |
#
restore_content_filters( $query )
Restores all removed filters May not be called
|
public |
#
load_styles( )
Enqueues the front-end stylesheet
|
public |
#
reset_post( $args )
Creates a dummy post modifies the globals $wp_query, $post
|
public |
#
remove_filters( $tag )
Remove all callbacks for a particular hook $tag.
|
public |
#
restore_filters( $tag )
Restores all callbacks for a particular hook $tag.
|
Properties
private
|
$instance
|
Singleton instance.
|
Hooks
Changelog
Related
- https://core.trac.wordpress.org/ticket/20509
- https://core.trac.wordpress.org/ticket/22355
- https://bbpress.trac.wordpress.org/ticket/2343 Questions 1. Should we load styles after the theme's style.css (but risk that wp_footer is not triggered?) 2. Should we use loop start/end to remove all content/excerpt filters and restore them again, or just clobber the callbacks by making sure we're last. Or both?