Here is a change proposal for “oh-add-script-header-footer.php”.
It may need some more checks, but i just did it without for now.
This works for me ??
add_action('wp', function(){
global $post;
$GLOBALS['oh_post_id'] = (isset($post->ID) ? $post->ID : false);
});
function oh_get_post_id()
{
global $oh_post_id, $post;
if(isset($oh_post_id) AND is_numeric($oh_post_id))
{
return $oh_post_id;
}
else if(isset($post->ID) && is_numeric($post->ID))
{
return $post->ID;
}
return false;
}
require_once plugin_dir_path( __FILE__ ) . "oh-settings-page.php";
// add google analytics to footer
function oh_add_script() {
$oh_post_id = oh_get_post_id();
if(!$oh_post_id) return false;
$output = get_post_meta($oh_post_id,'_oh_add_script_header',true);
echo stripslashes($output);
if(oh_show_me_on('oh_posttype') && get_post_meta(oh_post_id,'_oh_add_script_header_hide',true) != 'on' ){
$sogo_header_footer = get_option('sogo_header_footer');
if(isset($sogo_header_footer['oh_header'])){
echo stripslashes($sogo_header_footer['oh_header']);
}
}
}
function oh_add_script_footer() {
$oh_post_id = oh_get_post_id();
if(!$oh_post_id) return false;
$output = get_post_meta($oh_post_id,'_oh_add_script_footer',true);
echo stripslashes($output);
if(oh_show_me_on('oh_posttype_footer') && get_post_meta($oh_post_id,'_oh_add_script_footer_hide',true) != 'on' ) {
$sogo_header_footer = get_option('sogo_header_footer');
if (isset($sogo_header_footer['oh_footer'])) {
echo stripslashes($sogo_header_footer['oh_footer']);
}
}
}
add_action('wp_head', 'oh_add_script');
add_action('wp_footer', 'oh_add_script_footer');