get_content_injection_priority(); // only method name, since `WP AMP` plugin does not support class name $hooks[ $priority ][] = 'inject_content'; } return $hooks; } /** * `WP AMP`: gather css rules, since `WP AMP` does not allow inline css * * @param arr $wrapper_options * @return obj Advanced_Ads_Ad $ad */ public function gather_css( $wrapper_options, Advanced_Ads_Ad $ad ) { if ( ! isset( $wrapper_options['id'] ) ) { return $wrapper_options; } if ( isset( $wrapper_options['style'] ) ) { $_style_values_string = ''; foreach ( $wrapper_options['style'] as $_style_attr => $_style_values ){ if ( is_array( $_style_values ) ) { $_style_values_string .= $_style_attr . ': ' .implode( ' ', $_style_values ). '; '; } else { $_style_values_string .= $_style_attr . ': ' .$_style_values. '; '; } } Advanced_Ads_Responsive_Amp::$css .= sprintf( '#%s{ %s }', $wrapper_options['id'], $_style_values_string ); } return $wrapper_options; } /** * Add css rules to header. */ public function add_amp_css() { echo Advanced_Ads_Responsive_Amp::$css; } }