Added events class for Yoast plugins
This commit is contained in:
1 parent
df40e389ad
commit
112c14fde3
2 files changed
+41
-3
No files matched your search
+3
-3
@@ -162,13 +162,13 @@ class Laps {
|
||||
}
|
||||
|
||||
/**
|
||||
* When theme is done possibly add theme-specific events.
|
||||
* When theme is done possibly add vendor-specific events.
|
||||
*/
|
||||
static function after_setup_theme() {
|
||||
|
||||
foreach ( array( 'THA', 'Hybrid', 'Genesis', 'Thematic' ) as $theme ) {
|
||||
foreach ( array( 'THA', 'Hybrid', 'Genesis', 'Thematic', 'Yoast' ) as $vendor ) {
|
||||
|
||||
$class = "Rarst\\Laps\\{$theme}_Events";
|
||||
$class = "Rarst\\Laps\\{$vendor}_Events";
|
||||
/** @var Laps_Events $events */
|
||||
$events = new $class;
|
||||
self::add_events( $events->get() );
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Rarst\Laps;
|
||||
|
||||
/**
|
||||
* Events for Yoast plugins
|
||||
*/
|
||||
class Yoast_Events extends Laps_Events {
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function is_applicable() {
|
||||
|
||||
return class_exists( 'WPSEO_Frontend' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function get_events() {
|
||||
|
||||
$stops = array();
|
||||
|
||||
$stops['wpseo_head'][1] = array(
|
||||
'event' => 'WP SEO head hook',
|
||||
'category' => 'plugin',
|
||||
);
|
||||
|
||||
$stops['wpseo_head'][100] = array(
|
||||
'action' => 'stop',
|
||||
'event' => 'WP SEO head hook',
|
||||
'category' => 'plugin',
|
||||
);
|
||||
|
||||
return $stops;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user