Genesis and agentpress-listing', 'apl' ), 'http://www.studiopress.com/themes/genesis' ) ); } global $wpdb; $agents_metadata = 'agents_metadata'; $charset_collate = ''; if (!empty ($wpdb->charset)) $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}"; if (!empty ($wpdb->collate)) $charset_collate .= " COLLATE {$wpdb->collate}"; $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}{$agents_metadata} ( agent_meta_id bigint(20) unsigned NOT NULL auto_increment, agent_term_id bigint(20) unsigned NOT NULL default '0', agent_meta_key varchar(255) default NULL, agent_meta_value longtext, PRIMARY KEY (agent_meta_id), KEY taxonomy_id (agent_term_id), KEY meta_key (agent_meta_key) ) $charset_collate;"; $wpdb->query($sql); } } if ( !function_exists( 'agents_init' ) ) { function agents_init() { if ( !defined( 'AGENT_HOME_LINK' ) )define('AGENT_HOME_LINK',get_bloginfo('wpurl')."/wp-admin/admin.php?page=agent_display_details"); if ( !defined( 'CREATE_AGENT_FILE' ) )define('CREATE_AGENT_FILE',get_bloginfo('wpurl')."/wp-admin/admin.php?page=agent_display_details&sub=create_agent"); if ( !defined( 'AGENTS_LIST' ) )define('AGENTS_LIST',get_bloginfo('wpurl')."/wp-admin/admin.php?page=agent_display_details&sub=agents_list"); if ( !defined( 'EDIT_AGENTS' ) )define('EDIT_AGENTS',get_bloginfo('wpurl')."/wp-admin/admin.php?page=agent_display_details&sub=edit_agent"); add_action('admin_menu', 'agents_admin_menu'); require 'functions.php'; require 'create-agent.php'; require 'edit-agent.php'; require 'list-agent.php'; require "class-agent-widget.php"; require 'shortcodes.php'; add_action('admin_menu','remove_taxonomy_admin_menu'); add_action( 'widgets_init', 'property_wise_agent_register_widget' ); add_action( 'wp_enqueue_scripts', 'agents_enqueue_styles' );} } function agents_enqueue_styles(){ wp_enqueue_style( 'agents-css', get_bloginfo("siteurl").'/wp-content/plugins/agents/css/agent_style.css', array(), '1.0.1','all' ); do_action( 'agents_enqueue_styles' ); //echo ''; } function property_wise_agent_register_widget() { $widgets = 'Property_wise_agent_details'; register_widget( $widgets ); } function my_admin_scripts() { wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_register_script('my-upload', WP_PLUGIN_URL.'/agents/js/agents-photo-upload.js', array('jquery','media-upload','thickbox')); wp_enqueue_script('my-upload'); } function my_admin_styles() { wp_enqueue_style('thickbox'); } if (isset($_GET['page']) && $_GET['page'] == 'agent_display_details') { add_action('admin_print_scripts', 'my_admin_scripts'); add_action('admin_print_styles', 'my_admin_styles'); } function agents_admin_menu() { add_menu_page(__('Agents'), __('Agents'), 10, 'agent_display_details', 'agents_menu_manager',plugins_url('agents/images/icon.png'), 8); } if ( !function_exists( 'agents_menu_manager' ) ) { function agents_menu_manager() { if(isset($_GET['page']) || isset($_POST['page'])) if($_GET['page']=='agent_display_details' || $_POST['page']=='agent_display_details') { if(isset($_GET['sub']) || isset($_POST['sub'])) { if((isset($_GET['sub']) && $_GET['sub']=='create_agent') || (isset($_POST['sub']) && $_POST['sub']=='create_agent')) { add_new_agent(); } elseif((isset($_GET['sub']) && $_GET['sub']=='agents_list')) { agent_list_page(); } elseif((isset($_GET['sub']) && $_GET['sub']=='edit_agent')) { edit_agent_details(); } } else { agent_list_page(); } } }} if ( !function_exists( 'agents_heading' ) ) { function agents_heading($page="agents_list"){ ?>

Agents Add/Edit Agent


array( 'name' => 'real_esate_agents' , 'type' => 'string'), 'post_type' => array('name' => 'listing' , 'type' => 'string') ); add_option('real_estate_agents',$agent_arrs); // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Real Estate Agents', 'taxonomy general name' ), 'singular_name' => _x( 'Real Estate Agent', 'taxonomy singular name' ), 'search_items' => __( 'Search Real Estate Agents' ), 'all_items' => __( 'All Real Estate Agents' ), 'parent_item' => __( 'Parent Real Estate Agent' ), 'parent_item_colon' => __( 'Parent Real Estate Agent:' ), 'edit_item' => __( 'Edit Real Estate Agent' ), 'update_item' => __( 'Update Real Estate Agent' ), 'add_new_item' => __( 'Add New Real Estate Agent' ), 'new_item_name' => __( 'New Real Estate Agent Name' ), 'menu_name' => __( 'Real Estate Agent' ), ); register_taxonomy('real_estate_agents_tax','listing', array( 'public'=>true, 'hierarchical' => true, 'labels' => $labels, 'show_in_nav_menus' => false, 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'real_estate_agents_tax' ), )); } function remove_taxonomy_admin_menu() { // remove_submenu_page was introduced in 3.1 remove_submenu_page( 'edit.php?post_type=listing', 'edit-tags.php?taxonomy=real_estate_agents_tax&post_type=listing' ); } ?>