Easy Property Listings 3.5.15 Code Reference
  • Package
  • Class
  • Tree
  • Todo
  • Hook Reference

Packages

  • EPL
    • Admin
      • Actions
      • Classes
        • ContactsTable
        • ReportsGraph
        • Welcome
      • Contacts
      • ContactsActions
      • ContactsFunctions
      • Elements
      • Functions
      • Help
      • HelpSingle
      • Menus
      • MenusAddons
      • MenusExtensions
      • MenusLicenses
      • Plugins
      • Reports
      • ReportsGraphing
      • User
    • Assets
      • ScriptsStyles
      • SVG
    • Classes
      • AuthorLoader
      • AuthorMeta
      • Contact
      • Cron
      • CustomPostType
      • Forms
      • License
      • ListingAdvanced
      • ListingElements
      • MetaboxesCustomFields
      • Pagination
      • PropertyMeta
      • RenderFields
      • RestAPI
      • Search
      • Session
      • Updater
    • Compatibility
      • Extensions
      • Functions
      • Shortcodes
    • Functions
      • Actions
      • ConditionalTags
      • ErrorTracking
      • Formatting
      • Front
      • Global
      • Install
      • Pagination
      • Settings
      • Templates
    • Hooks
      • EnergyCertificate
      • ExternalLinks
      • FloorPlan
      • Map
      • ReadMore
      • WebLink
    • Meta
      • InitCustomFields
      • Meta
    • PostTypes
      • Business
      • Commercial
      • CommercialLand
      • Contact
      • Functions
      • Land
      • Property
      • Rental
      • Rural
    • Shortcode
      • CommercialListingSearch
      • ContactForm
      • Listing
      • ListingAdvanced
      • ListingAuction
      • ListingCategory
      • ListingFeature
      • ListingLocation
      • ListingMetaDoc
      • ListingOpen
      • ListingResults
      • ListingSearch
      • Map
    • Taxonomy
      • BusinessCategories
      • ContactTag
      • Features
      • Location
    • Templates
      • Themes
        • iThemes
        • iThemesBuilder
    • Widget
      • Admin
        • Dashboard
      • Classes
        • Author
        • ContactCapture
        • Gallery
        • Listing
        • Search
      • Functions
  • None
  • WordPress
    • Session

Classes

  • EPL_Advanced_Shortcode_Listing
  • EPL_Author
  • EPL_Author_Loader
  • EPL_Author_Meta
  • EPL_Contact
  • EPL_Contact_Reports_Table
  • EPL_CPT
  • EPL_Cron
  • EPL_FORM_BUILDER
  • EPL_Graph
  • EPL_License
  • EPL_Listing_Elements
  • EPL_METABOX
  • EPL_Pagination_Call
  • EPL_Property_Meta
  • EPL_Render_Fields
  • EPL_Rest_API
  • EPL_SEARCH
  • EPL_Search_Fields
  • EPL_Session
  • EPL_SL_Plugin_Updater
  • EPL_Welcome
  • EPL_Widget_Author
  • EPL_Widget_Contact_Capture
  • EPL_Widget_Property_Gallery
  • EPL_Widget_Property_Search
  • EPL_Widget_Recent_Property

Functions

  • EPL
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 
<?php
/**
 * Register post type :: Business
 *
 * @package     EPL
 * @subpackage  PostTypes/Business
 * @copyright   Copyright (c) 2020, Merv Barrett
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Registers and sets up the Business custom post type.
 *
 * @since 1.0
 * @since 3.5.1 View Land Listings added for plural.
 *
 * @return void
 */
function epl_register_custom_post_type_business() {

    $archives = defined( 'EPL_BUSINESS_DISABLE_ARCHIVE' ) && EPL_BUSINESS_DISABLE_ARCHIVE ? false : true;
    $slug     = defined( 'EPL_BUSINESS_SLUG' ) ? EPL_BUSINESS_SLUG : 'business';
    $rewrite  = defined( 'EPL_BUSINESS_DISABLE_REWRITE' ) && EPL_BUSINESS_DISABLE_REWRITE ? false : array(
        'slug'       => $slug,
        'with_front' => false,
    );
    $rest     = defined( 'EPL_BUSINESS_DISABLE_REST' ) && EPL_BUSINESS_DISABLE_REST ? false : true;

    $labels = apply_filters(
        'epl_business_labels',
        array(
            'name'               => __( 'Business Listings', 'easy-property-listings' ),
            'singular_name'      => __( 'Business Listings', 'easy-property-listings' ),
            'menu_name'          => __( 'Business', 'easy-property-listings' ),
            'add_new'            => __( 'Add New', 'easy-property-listings' ),
            'add_new_item'       => __( 'Add New Business Listing', 'easy-property-listings' ),
            'edit_item'          => __( 'Edit Business Listing', 'easy-property-listings' ),
            'new_item'           => __( 'New Business Listing', 'easy-property-listings' ),
            'update_item'        => __( 'Update Business Listing', 'easy-property-listings' ),
            'all_items'          => __( 'All Business Listings', 'easy-property-listings' ),
            'view_item'          => __( 'View Business Listing', 'easy-property-listings' ),
            'view_items'         => __( 'View Business Listings', 'easy-property-listings' ),
            'search_items'       => __( 'Search Business Listing', 'easy-property-listings' ),
            'not_found'          => __( 'Business Listing Not Found', 'easy-property-listings' ),
            'not_found_in_trash' => __( 'Business Listing Not Found in Trash', 'easy-property-listings' ),
            'parent_item_colon'  => __( 'Parent Business Listing:', 'easy-property-listings' ),
        )
    );

    $business_args = array(
        'labels'             => $labels,
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => $rewrite,
        'menu_icon'          => 'dashicons-cart',
        'capability_type'    => 'post',
        'has_archive'        => $archives,
        'hierarchical'       => false,
        'menu_position'      => '26.6',
        'show_in_rest'       => $rest,
        'taxonomies'         => array( 'location', 'tax_feature' ),
        'supports'           => apply_filters( 'epl_business_supports', array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) ),
    );
    epl_register_post_type( 'business', 'Business', apply_filters( 'epl_business_post_type_args', $business_args ) );
}
add_action( 'init', 'epl_register_custom_post_type_business', 0 );


/**
 * Manage Admin Business Post Type Columns.
 *
 * @since 1.0
 * @return void
 */
if ( is_admin() ) {
    /**
     * Manage Admin Business Post Type Columns: Heading.
     *
     * @param array $columns Column array.
     *
     * @return mixed|void $columns with epl_post_type_business_admin_columns filter.
     * @since 1.0
     */
    function epl_manage_business_columns_heading( $columns ) {

        $columns = array(
            'cb'                => '<input type="checkbox" />',
            'property_featured' => '<span class="dashicons dashicons-star-half"></span><span class="epl-manage-featured">' . __( 'Featured', 'easy-property-listings' ) . '</span>',
            'property_thumb'    => __( 'Image', 'easy-property-listings' ),
            'property_price'    => __( 'Price', 'easy-property-listings' ),
            'title'             => __( 'Address', 'easy-property-listings' ),
            'listing'           => __( 'Listing Details', 'easy-property-listings' ),
            'listing_id'        => __( 'Unique ID', 'easy-property-listings' ),
            'geo'               => __( 'Geo', 'easy-property-listings' ),
            'property_status'   => __( 'Status', 'easy-property-listings' ),
            'agent'             => __( 'Agent', 'easy-property-listings' ),
            'date'              => __( 'Date', 'easy-property-listings' ),
        ) + $columns;

        // unset author columns as duplicate of agent column.
        unset( $columns['author'] );
        unset( $columns['comments'] );

        // Geocode Column.
        if ( 1 !== (int) epl_get_option( 'debug', 0 ) ) {
            unset( $columns['geo'] );
        }

        // Listing ID Column.
        if ( 1 !== (int) epl_get_option( 'admin_unique_id', 0 ) ) {
            unset( $columns['listing_id'] );
        }

        return apply_filters( 'epl_post_type_business_admin_columns', $columns );
    }
    add_filter( 'manage_edit-business_columns', 'epl_manage_business_columns_heading' );

    /**
     * Manage Admin Business Post Type Columns: Row Contents.
     *
     * @since 1.0
     * @param string $column column.
     * @param int    $post_id post id.
     */
    function epl_manage_business_columns_value( $column, $post_id ) {
        global $post,$property;
        switch ( $column ) {

            // If displaying the 'Featured Star' column.
            case 'property_featured':
                do_action( 'epl_manage_listing_column_featured' );

                break;

            // If displaying the 'Featured' image column.
            case 'property_thumb':
                do_action( 'epl_manage_listing_column_property_thumb' );

                break;

            // If displaying the 'Listing Details' column.
            case 'listing':
                do_action( 'epl_manage_listing_column_listing' );

                break;

            // If displaying the 'Listing ID' column.
            case 'listing_id':
                do_action( 'epl_manage_listing_column_listing_id' );

                break;

            // If displaying the 'Geocoding' column.
            case 'geo':
                do_action( 'epl_manage_listing_column_geo' );

                break;

            // If displaying the 'Price' column.
            case 'property_price':
                do_action( 'epl_manage_listing_column_price' );

                break;

            // If displaying the 'property_status' column.
            case 'property_status':
                do_action( 'epl_manage_listing_column_property_status' );

                break;

            // If displaying the 'agent' column.
            case 'agent':
                do_action( 'epl_manage_listing_column_agent' );

                break;

            // Just break out of the switch statement for everything else.
            default:
                break;
        }

    }
    add_action( 'manage_business_posts_custom_column', 'epl_manage_business_columns_value', 10, 2 );

    /**
     * Manage Business Columns Sorting
     *
     * @param array $columns Column array.
     *
     * @return array
     * @since 1.0
     */
    function epl_manage_business_sortable_columns( $columns ) {
        $columns['property_status'] = 'property_status';
        return $columns;
    }
    add_filter( 'manage_edit-business_sortable_columns', 'epl_manage_business_sortable_columns' );
}
Easy Property Listings 3.5.15 Code Reference API documentation generated by ApiGen