Ads Admin Panel

Welcome!

user_firstname != '') ? wp_get_current_user()->user_firstname : wp_get_current_user()->user_login; ?>

Eric @ datafeedr.com Hi, !

Thanks for using the Ads plugin! We'd love to hear what you think.

Eric Busch
datafeedr.com

Sell Products on your Blog

Increase your blog's earnings!
Add a store to your WordPress blog.
Learn More!

Datafeedr Affiliate Program

Earn 35% Recurring Commissions with the datafeedr affiliate program! Get started in minutes. Sign up now!

General Settings

'; settings_fields( 'dfads-settings-group' ); do_settings_sections( 'dfads-settings' ); submit_button(); echo ''; ?>

Shortcode / PHP Template Code Generator

include_generator(); ?>

Check this box to enable shortcode rendering in Text modules so you can add your ads to your widgetized areas.
By default, WordPress Text widgets do not render shortcodes.

'; } // Admin impression count checkbox option. public function dfads_enable_count() { $output = get_option( 'dfads-settings' ); echo '

Check this box to enable increasing an ad\'s impression count value when viewed by an account with admin permissions.

'; } // Loads the shortcode generator script. public function include_generator() { return require_once( DFADS_PLUGIN_PATH . 'inc/generator.php' ); } // This adds custom fields to the list of ads here: edit.php?post_type=dfads function set_custom_edit_dfads_columns($columns) { return $columns + array( 'start_date' => __('Start Date'), 'end_date' => __('End Date'), 'impression_count' => __('Impression Count'), 'impression_limit' => __('Impression Limit'), 'ad' => __('Ad'), ); } // This determines what to show in each column on the edit.php?post_type=dfads page. function posts_custom_column( $column, $post_id ) { switch ( $column ) { case 'ad': echo get_post($post_id)->post_content; break; case 'start_date': $start_date = get_post_meta( $post_id , '_dfads_start_date' , true ); if ( $start_date != '') { echo date_i18n( 'm/d/Y', $start_date ); } else { echo 'Immediately'; } break; case 'end_date': $end_date = get_post_meta( $post_id , '_dfads_end_date' , true ); if ( $end_date != '') { echo date_i18n( 'm/d/Y', $end_date ); } else { echo 'Never'; } break; case 'impression_count': $count = get_post_meta( $post_id , '_dfads_impression_count' , true ); $count = intval( $count ); echo number_format( $count ); break; case 'impression_limit': $limit = get_post_meta( $post_id , '_dfads_impression_limit' , true ); if ( $limit > 0 ) { echo number_format( $limit ); } else { echo 'Unlimited'; } break; } // switch ( $column ) { } // This initializes sorting on the custom field columns. function dfads_sortable_columns( $columns ) { $columns['start_date'] = '_dfads_start_date'; $columns['end_date'] = '_dfads_end_date'; $columns['impression_count'] = '_dfads_impression_count'; $columns['impression_limit'] = '_dfads_impression_limit'; return $columns; } // This captures the $_REQUEST so we can modify the query for sortable columns. function edit_dfads_load() { add_filter( 'request', array( $this, 'dfads_sort_custom_fields' ) ); } // Figure out what columns we are sorting on so we can update the query. function dfads_sort_custom_fields( $vars ) { if ( isset( $vars['post_type'] ) && 'dfads' == $vars['post_type'] ) { // start date if ( isset( $vars['orderby'] ) && '_dfads_start_date' == $vars['orderby'] ) { $vars = array_merge( $vars, array( 'meta_key' => '_dfads_start_date', 'orderby' => 'meta_value_num' ) ); } // end date if ( isset( $vars['orderby'] ) && '_dfads_end_date' == $vars['orderby'] ) { $vars = array_merge( $vars, array( 'meta_key' => '_dfads_end_date', 'orderby' => 'meta_value_num' ) ); } // impression count if ( isset( $vars['orderby'] ) && '_dfads_impression_count' == $vars['orderby'] ) { $vars = array_merge( $vars, array( 'meta_key' => '_dfads_impression_count', 'orderby' => 'meta_value_num' ) ); } // impression limit if ( isset( $vars['orderby'] ) && '_dfads_impression_limit' == $vars['orderby'] ) { $vars = array_merge( $vars, array( 'meta_key' => '_dfads_impression_limit', 'orderby' => 'meta_value_num' ) ); } } return $vars; } } new DFADS_Admin();