*/
class Applyonline_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
add_action( 'init', array( $this, 'register_aol_post_types' ) );
add_shortcode( 'aol_ads', array($this, 'shortcode_generator') );
// Hook - Applicant Listing - Column Name
add_filter( 'manage_edit-aol_application_columns', array ( $this, 'applicants_list_columns' ) );
// Hook - Applicant Listing - Column Value
add_action( 'manage_aol_application_posts_custom_column', array ( $this, 'applicants_list_columns_value' ), 10, 2 );
add_filter('post_row_actions',array($this, 'application_row_actions'), 10, 2);
// Add Application data to the Application editor.
add_action ( 'edit_form_after_title', array ( $this, 'aol_application_post_editor' ) );
new MetaBoxes();
new AjaxHandler();
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Applyonline_Loader as all of the hooks are defined
* in that particular class.
*
* The Applyonline_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/applyonline-admin.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Applyonline_Loader as all of the hooks are defined
* in that particular class.
*
* The Applyonline_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/applyonline-admin.js', array( 'jquery' ), $this->version, false );
}
function register_aol_post_types(){
/*Register Main Post Type*/
$labels=array(
'add_new' => 'Create an Ad',
'add_new_item' => 'New Ad',
'edit_item' => 'Edit Ad',
'all_items' => 'All Ads',
'menu_name' => 'Apply Online'
);
$args=array(
'label' => __( 'All Ads', 'applyonline' ),
'labels'=> $labels,
'public'=> true,
'show_in_nav_menus' => false,
'menu_icon' => 'dashicons-admin-site',
'description' => __( 'Ad Posting' ),
'supports' => array('title', 'editor'),
'rewrite' => array('slug'=>'ads'),
);
register_post_type('aol_ad',$args);
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
'name' => _x( 'Ad Categories', 'taxonomy singular name', 'applyOnline' ),
'singular_name' => _x( 'Ad Category','taxonomy singular name', 'applyOnline' ),
'search_items' => __( 'Search Categories' ),
'all_items' => __( 'All Categories' ),
'parent_item' => __( 'Parent Category' ),
'parent_item_colon' => __( 'Parent Category:' ),
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Category Name' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'adcat' ),
);
register_taxonomy( 'aol_ad_category', array( 'aol_ad' ), $args );
/*Register Applications Post Type*/
$lables= array(
'edit_item'=>'Application'
);
$args=array(
'label' => __( 'Applications', 'applyonline' ),
'labels' => $lables,
'public' => true,
'show_in_nav_menus' => false,
'exclude_from_search'=> true,
'publicly_queryable' => false,
'map_meta_cap' => true,
'show_in_menu' => 'edit.php?post_type=aol_ad',
'description' => __( 'List of Applications with their resume', 'applyonline' ),
'supports' => array('editor'),
'capabilities' => array(
'create_posts' => false,
)
);
register_post_type('aol_application',$args);
}
/**
* Shortcode Generator
* @param type $atts
* @return type
*/
function shortcode_generator( $atts ) {
$a = shortcode_atts( array(
'ads' => '-1',
'excerpt' => 'yes',
), $atts );
$args=array(
'posts_per_page' => $a['ads'],
'post_type' =>'aol_ad',
);
query_posts( $args );
function custom_excerpt_more( $more ) {
return '....';
}
add_filter( 'excerpt_more', 'custom_excerpt_more' );
ob_start();
echo '