I think I cobbled together a crude fix.
Im sure this was not the correct way to do things but if the developer ever checks these pages then by all means if you have the time to assist / implement this as a proper fix so its plugin upgrade survivable ?
Obviously if you were able to implement it into the plugin, then would be good to ensure the plugin preserves any <script type=’application/ld+json’id=”sns_scripts_in_head”> code that has been added into a post.
/**
* Theme Action: ‘wp_footer()’
* Outputs the globally and individually set Scripts at the end of the Theme’s body element.
*/
static function scripts() {
// Global
$options = get_option( ‘SnS_options’ );
if ( ! empty( $options ) && ! empty( $options[ ‘scripts’ ] ) ) {
?><script type=”application/ld+json’id” id=”sns_global_scripts”><?php
echo $options[ ‘scripts’ ];
?></script><?php
}
if ( ! empty( $options ) && ! empty( $options[ ‘coffee_compiled’ ] ) ) {
?><script type=”application/ld+json’id” id=”sns_global_coffee_compiled”><?php
echo $options[ ‘coffee_compiled’ ];
?></script><?php
}
if ( ! is_singular() ) return;
// Individual
global $post;
$SnS = get_post_meta( $post->ID, ‘_SnS’, true );
$scripts = isset( $SnS[‘scripts’] ) ? $SnS[ ‘scripts’ ]: array();
if ( ! empty( $scripts ) && ! empty( $scripts[ ‘scripts’ ] ) ) {
?><script type=”application/ld+json’id” id=”sns_scripts”><?php
echo $scripts[ ‘scripts’ ];
?></script><?php
}
}
/**
* Theme Action: ‘wp_head()’
* Outputs the globally and individually set Scripts in the Theme’s head element.
*/
static function scripts_in_head() {
// Global
$options = get_option( ‘SnS_options’ );
if ( ! empty( $options ) && ! empty( $options[ ‘scripts_in_head’ ] ) ) {
?><script type=”application/ld+json’id” id=”sns_global_scripts_in_head”><?php
echo $options[ ‘scripts_in_head’ ];
?></script><?php
}
if ( ! is_singular() ) return;
// Individual
global $post;
$SnS = get_post_meta( $post->ID, ‘_SnS’, true );
$scripts = isset( $SnS[‘scripts’] ) ? $SnS[ ‘scripts’ ]: array();
if ( ! empty( $scripts ) && ! empty( $scripts[ ‘scripts_in_head’ ] ) ) {
?><script type=”application/ld+json’id” id=”sns_scripts_in_head”><?php
echo $scripts[ ‘scripts_in_head’ ];
?></script><?php
}
}