-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-fix-yoast-organization-schema.php
40 lines (33 loc) · 1.16 KB
/
wp-fix-yoast-organization-schema.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Plugin Name: Fix Yoast Organization Schema
* Plugin URI: https://github.com/robwent/wp-fix-yoast-organization-schema
* Description: Adds additional Organization schema to Yoast output.
* Version: 1.0.1
* Author: Robert Went
* Author URI: https://www.robertwent.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// If this file is called directly or we are in the admin area, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// DOn't run in the admin area or if Yoast isn't active
if ( is_admin() || ! defined( 'WPSEO_VERSION' ) ) {
return false;
}
include( dirname( __FILE__ ) . '/classes/Schema_OrganizationDetails.php' );
/**
* Adds Schema pieces to our output.
*
* @param array $pieces Graph pieces to output.
* @param \WPSEO_Schema_Context $context Object with context variables.
*
* @return array $pieces Graph pieces to output.
*/
function wp_fix_yoast_organization_pieces( $pieces, $context ) {
$pieces[] = new Schema_OrganizationDetails( $context );
return $pieces;
}
add_filter( 'wpseo_schema_graph_pieces', 'wp_fix_yoast_organization_pieces', 11, 2 );