\n".$single_styles.$global_styles; echo str_replace('', $data."\n", $output); } /* Display */ add_action('the_content', 'art_inline'); function art_inline($data) { global $post, $global_styles, $single_styles; if(is_single() or is_page()) $single_styles .= str_replace( '#postid', $post->ID, get_post_meta($post->ID, 'art_direction_single', true) )."\n"; $global_styles .= str_replace( '#postid', $post->ID, get_post_meta($post->ID, 'art_direction_global', true) )."\n"; return $data; } /* Publish */ add_action('publish_page','art_save_postdata'); add_action('publish_post','art_save_postdata'); add_action('save_post','art_save_postdata'); add_action('edit_post','art_save_postdata'); /* Save Data */ function art_save_postdata( $post_id ) { // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if ( !wp_verify_nonce( $_POST['art-direction-nonce'], plugin_basename(__FILE__) ) ) return $post_id; if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id ) ) return $post_id; } else { if ( !current_user_can( 'edit_post', $post_id ) ) return $post_id; } // OK, we're authenticated: we need to find and save the data delete_post_meta( $post_id, 'art_direction_single' ); delete_post_meta( $post_id, 'art_direction_global' ); if(trim($_POST['single-code']) != '') add_post_meta( $post_id, 'art_direction_single', stripslashes($_POST['single-code']) ); if(trim($_POST['global-code']) != '') add_post_meta( $post_id, 'art_direction_global', stripslashes($_POST['global-code']) ); return true; } /* admin interface */ add_action('admin_menu', 'art_add_meta_box'); add_action('admin_head', 'art_admin_head'); function art_admin_head() { ?>