'; } } /** * Toggle Featured status of a product from admin. */ public static function feature_post() { if ( current_user_can( 'edit_posts' ) && check_admin_referer( 'aqpanel-featured-post' ) && isset( $_GET['post'] ) ) { $aqpanel_featured = sanitize_title( $_GET['aqpanel_featured'] ); $id = sanitize_title( (int)$_GET['post'] ); if( !empty( $id ) && $aqpanel_featured !== NULL ) { if ( $aqpanel_featured == 'no' ){ delete_post_meta( $id, "_is_aqpanel_featured_post" ); } else { update_post_meta( $id, "_is_aqpanel_featured_post", 'yes' ); } } } wp_safe_redirect( wp_get_referer() ? remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), wp_get_referer() ) : admin_url( 'edit.php' ) ); exit; } /** * Add columns to the listing. */ public function aqpanel_featured_posts_add_columns_head(){ global $aqpanel_options; foreach ( $aqpanel_options['aqpanel_posttypes'] as $post_type => $value ) { add_filter('manage_edit-'.$post_type.'_columns', array( $this,'add_featured_column_heading'), 2); add_action('manage_'.$post_type.'_posts_custom_column', array( $this,'add_featured_column_content'), 10, 2); } } } endif; if ( class_exists( 'Admin_Quick_Panel_Column', false ) ) { return new Admin_Quick_Panel_Column(); }