From bbeb02e7c0dbe7868444fa9bb9e6c319785ee34e Mon Sep 17 00:00:00 2001 From: Frumph Date: Mon, 24 Aug 2015 23:21:03 -0700 Subject: [PATCH] Cleaned up execution hooks and removed some non-functional code from the ceo-admin.php Redid the start of the clearprice for buyprint, will make it a button in the future --- ceo-admin.php | 33 +++++++++++---------------------- functions/redirects.php | 17 +++++++++++------ 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/ceo-admin.php b/ceo-admin.php index ac4d0b0..43ccf8e 100644 --- a/ceo-admin.php +++ b/ceo-admin.php @@ -3,23 +3,30 @@ // actions add_action('admin_menu', 'ceo_add_menu_pages'); add_action('admin_enqueue_scripts', 'ceo_comic_editor_scripts', 10, 1 ); + if (ceo_pluginfo('add_dashboard_frumph_feed_widget')) add_action('wp_dashboard_setup', 'ceo_add_dashboard_widgets' ); function ceo_comic_editor_scripts( $hook ) { - global $post; - if (!empty($post)) { - if ( $hook == 'post-new.php' || $hook == 'post.php' ) { + global $pagenow, $post; + if (!empty($pagenow)) { +/* + if ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) { if ('comic' === $post->post_type) { + wp_enqueue_script('ceo-upload-flash', ceo_pluginfo('plugin_url').'js/upload-flash.js'); wp_enqueue_media(); } } - if ($hook == 'edit.php') { + if ($pagenow == 'edit.php') { if ('comic' == $post->post_type) { add_action('admin_footer', 'ceo_change_chapter_to_radio'); } } + if ($pagenow == 'edit-tags.php') { + wp_enqueue_script('ceo-inline-edit', ceo_pluginfo('plugin_url').'js/custom_inline_edit_tax.dev.js'); + } +*/ } } @@ -130,21 +137,3 @@ function ceo_enqueue_admin_cpt_style( $cpt, $handle, $src = false, $deps = array } -/* -// Dysfunctional Code -function ceo_comic_shortlinks( $shortlink, $id, $context, $allow_slugs=true ) { - var_dump($context); - if (('post' == $context) && !$shortlink) { - if (function_exists('wpme_get_shortlink')) { - $blog_id = Jetpack_Options::get_option( 'id' ); - $type= 'p'; - $shortlink = 'http://wp.me/' . wpme_dec2sixtwo( $id ); - var_dump($shortlink); - } else { - $shortlink = home_url('?p='.$post->ID); - } - } - return $shortlink; -} -*/ - diff --git a/functions/redirects.php b/functions/redirects.php index b0b38cd..36ffb9c 100644 --- a/functions/redirects.php +++ b/functions/redirects.php @@ -258,11 +258,16 @@ if (isset($_GET['clearprice'])) add_action('template_redirect', 'ceo_clearprice'); function ceo_clearprice() { - global $wpdb; - $sql = "DELETE * FROM {$wpdb->postmeta} where meta_key = 'buy_print_amount'"; - $wpdb->query($sql); - $sql = "DELETE * FROM {$wpdb->postmeta} where meta_key = 'buy_print_orig_amount'"; - $wpdb->query($sql); - exit; + + $post_args = array( + 'showposts' => -1, + 'post_type' => 'comic', + 'order' => 'ASC' + ); + $qposts = get_posts( $post_args ); + foreach($qposts as $qpost) { + delete_post_meta($qpost->ID, 'buy_print_orig_amount'); + } } +// exit; */