Skip to content

Commit

Permalink
remove schema if AMP plugin is detected awesomemotive#575
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltorbert committed Oct 11, 2016
1 parent 0185a64 commit 2a4a646
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions modules/aioseop_opengraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function __construct() {

$this->help_anchors = Array(
'title_shortcodes' => '#run-shortcodes-in-title',
'description_shortcodes' => '#run-shortcodes-in-description',
'description_shortcodes' => '#run-shortcodes-in-description',
'generate_descriptions' => '#auto-generate-og-descriptions',
'setmeta' => '#use-aioseo-title-and-description',
'sitename' => '#site-name',
Expand Down Expand Up @@ -179,7 +179,7 @@ function __construct() {
'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section',
'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags',
'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type',
'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image',
'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image',
);

$count_desc = __( " characters. Open Graph allows up to a maximum of %s chars for the %s.", 'all-in-one-seo-pack' );
Expand Down Expand Up @@ -797,11 +797,17 @@ function add_attributes( $output ) { // avoid having duplicate meta tags
$type = 'WebSite';
}

$attributes = apply_filters( $this->prefix . 'attributes', Array(
'itemscope',
'itemtype="http://schema.org/' . ucfirst( $type ) . '"',
'prefix="og: http://ogp.me/ns#"',
) );
$attr_array = Array();

// Don't show this schema.org if the AMP plugin is active.
if ( ! function_exists( 'amp_init' ) ) {
$attr_array[] = 'itemscope';
$attr_array[] = 'itemtype="http://schema.org/' . ucfirst( $type ) . '"';
}

$attr_array[] = 'prefix="og: http://ogp.me/ns#"';

$attributes = apply_filters( $this->prefix . 'attributes', $attr_array );
foreach ( $attributes as $attr ) {
if ( strpos( $output, $attr ) === false ) {
$output .= "\n\t$attr ";
Expand Down

0 comments on commit 2a4a646

Please sign in to comment.