show_ui ) {
add_meta_box( 'actc-adtc-meta-boxes', __('Google Adwords Tracking Code', ACTC_SLUG), 'actc_adtc_meta_boxes', $post_type->name, 'normal', 'default' );
}
}
} else {
add_meta_box( 'actc-adtc-meta-boxes', __('Google Adwords Tracking Code', ACTC_SLUG), 'actc_adtc_meta_boxes', 'post', 'normal', 'default' );
add_meta_box( 'actc-adtc-meta-boxes', __('Google Adwords Tracking Code', ACTC_SLUG), 'actc_adtc_meta_boxes', 'page', 'normal', 'default' );
}
}
function actc_adtc_meta_boxes() {
global $post;
$new_meta_boxes =array(
"image" => array(
"name" => "actc_adtc",
"std" => "",
"title" => __("Adwords Tracking", ACTC_SLUG),
"description" => __("Add Your Tracking Code", ACTC_SLUG)
)
);
foreach($new_meta_boxes as $meta_box) {
$meta_box_value = get_post_meta($post->ID, $meta_box['name'].'_value', true);
if($meta_box_value == "")
$meta_box_value = $meta_box['std'];
echo'';
echo'
';
echo'';
}
}
function actcSettingsPage() {
$message = null;
if(@$_POST['submit']){
if ( !wp_verify_nonce( @$_POST['actc_nonce'], 'actc_adtc_nonce') ){
$message = __("Security Error!!!", ACTC_SLUG);
}else{
update_option( 'actc_adword_code', $_POST['actc_adword_code'] );
}
}
$tlpAdwordCode = get_option('actc_adword_code');
?>
";
}
?>
ID, 'actc_adtc_value', true);
if($metacode){
$tlpAdwordCode = $metacode;
}else{
$tlpAdwordCode = stripslashes(get_option('actc_adword_code'));
}
$html = null;
$html .= $tlpAdwordCode;
if($tlpAdwordCode){
echo $html;
}
}
function tlp_save_adword($post_id, $post, $update){
global $post;
$new_meta_boxes =array(
"image" => array(
"name" => "actc_adtc",
"std" => "",
"title" => __("Adwords Tracking", ACTC_SLUG),
"description" => __("Add Your Tracking Code", ACTC_SLUG)
)
);
foreach($new_meta_boxes as $meta_box) {
// Verify
if ( !wp_verify_nonce( @$_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {
return $post_id;
}
$data = $_POST[$meta_box['name'].'_value'];
if(get_post_meta($post_id, $meta_box['name'].'_value') == "")
add_post_meta($post_id, $meta_box['name'].'_value', $data, true);
elseif($data != get_post_meta($post_id, $meta_box['name'].'_value', true))
update_post_meta($post_id, $meta_box['name'].'_value', $data);
elseif($data == "")
delete_post_meta($post_id, $meta_box['name'].'_value', get_post_meta($post_id, $meta_box['name'].'_value', true));
}
}
add_action('wp_footer','tlp_Adword_Display');
add_action('save_post', 'tlp_save_adword', 10, 3);
add_action( 'plugins_loaded', 'tlp_team_load_textdomain' );
/**
* Load plugin textdomain.
*
* @since 1.0.0
*/
function tlp_team_load_textdomain() {
load_plugin_textdomain( ACTC_SLUG, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}