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 
<?php
/**
 * Loading the templates
 * Needs to work with other themes. These template files af a function that iThemes Builder needs to render the template.
 *
 * @package     EPL
 * @subpackage  Templates/Themes
 * @copyright   Copyright (c) 2020, Merv Barrett
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0.0
 */

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

// phpcs:disable WordPress.Security.NonceVerification

/**
 * Load Custom Template from Plugin Directory
 *
 * @param string $template Template name.
 *
 * @return string
 * @since 1.0.0
 */
function epl_load_core_templates( $template ) {

    global $epl_settings;

    $template_path = epl_get_content_path();

    if ( isset( $epl_settings['epl_feeling_lucky'] ) && 'on' === $epl_settings['epl_feeling_lucky'] ) {
        return $template;
    }

    $post_tpl = '';
    if ( is_epl_post_single() ) {

        $common_tpl = apply_filters( 'epl_common_single_template', 'single-listing.php' );
        $post_tpl   = 'single-' . str_replace( '_', '-', get_post_type() ) . '.php';
        $find[]     = $post_tpl;
        $find[]     = epl_template_path() . $post_tpl;
        $find[]     = $common_tpl;
        $find[]     = epl_template_path() . $common_tpl;

    } elseif ( epl_is_search() ) {

        $common_tpl = apply_filters( 'epl_common_search_template', 'archive-listing.php' );
        $post_tpl   = 'archive-listing.php';
        if ( isset( $_GET['post_type'] ) ) {

            if ( is_array( $_GET['post_type'] ) ) {
                $post_tpl = 'search-listing.php';
            } else {
                $post_tpl = 'search-' . sanitize_title( wp_unslash( $_GET['post_type'] ) ) . '.php';
            }
        }
        $find[] = $post_tpl;
        $find[] = epl_template_path() . $post_tpl;
        $find[] = 'search-listing.php';
        $find[] = epl_template_path() . 'search-listing.php';
        $find[] = $common_tpl;
        $find[] = epl_template_path() . $common_tpl;
        $find   = array_unique( $find );

    } elseif ( is_epl_post_archive() ) {
        $common_tpl = apply_filters( 'epl_common_archive_template', 'archive-listing.php' );
        $post_tpl   = 'archive-' . str_replace( '_', '-', get_post_type() ) . '.php';
        $find[]     = $post_tpl;
        $find[]     = epl_template_path() . $post_tpl;
        $find[]     = $common_tpl;
        $find[]     = epl_template_path() . $common_tpl;
    } elseif ( is_tax( 'location' ) || is_tax( 'tax_feature' ) || is_tax( 'tax_business_listing' ) ) {

        $term       = get_queried_object();
        $common_tpl = apply_filters( 'epl_common_taxonomy_template', 'archive-listing.php' );

        $post_tpl = 'taxonomy-' . $term->taxonomy . '.php';
        $find[]   = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[]   = epl_template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[]   = 'taxonomy-' . $term->taxonomy . '.php';
        $find[]   = epl_template_path() . 'taxonomy-' . $term->taxonomy . '.php';
        $find[]   = $common_tpl;
        $find[]   = $post_tpl;
        $find[]   = epl_template_path() . $common_tpl;

    }
    if ( $post_tpl ) {
        /*** Template found in theme ? */
        $template = locate_template( array_unique( $find ) );
        if ( ! $template ) {
            /*** If not found, fallback to extension's default template */
            $template = $template_path . $common_tpl;

            if ( ! file_exists( $template ) ) {
                /*** If extension doesnt have templates, fallback to core templates */
                $template = EPL_PATH_TEMPLATES_CONTENT . $common_tpl;
            }
        }
    }
    return $template;

}
add_filter( 'template_include', 'epl_load_core_templates' );

/**
 * Template Loader for Single Listings
 *
 * @since 2.0.0
 * @since 3.4.14 Added TwentyTwenty theme support.
 * @since 3.4.26 Added Avada theme support.
 */
function epl_render_single_post() {

    if ( epl_is_builder_framework_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES_ITHEMES;
    } elseif ( epl_is_genesis_framework_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES_GENESIS;
    } elseif ( epl_is_divi_framework_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . 'divi/';
    } elseif ( epl_is_twenty_twenty_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . 'twentytwenty/';
    } elseif ( epl_is_avada_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . 'avada/';
    } elseif ( file_exists( EPL_PATH_TEMPLATES_POST_TYPES . epl_get_active_theme() ) ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . trailingslashit( epl_get_active_theme() );
    } else {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES_DEFAULT;
    }
    $common_tpl = 'single-listing.php';
    $template   = $template_path . $common_tpl;
    include $template;
}
add_action( 'epl_render_single_post', 'epl_render_single_post' );

/**
 * Template Loader for Archive
 *
 * @since 2.0.0
 * @since 3.4.14 Added TwentyTwenty theme support.
 * @since 3.4.26 Added Avada theme support.
 */
function epl_render_archive_post() {

    if ( epl_is_builder_framework_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES_ITHEMES;
    } elseif ( epl_is_genesis_framework_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES_GENESIS;
    } elseif ( epl_is_divi_framework_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . 'divi/';
    } elseif ( epl_is_twenty_twenty_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . 'twentytwenty/';
    } elseif ( epl_is_avada_theme() ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . 'avada/';
    } elseif ( file_exists( EPL_PATH_TEMPLATES_POST_TYPES . epl_get_active_theme() ) ) {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES . trailingslashit( epl_get_active_theme() );
    } else {
        $template_path = EPL_PATH_TEMPLATES_POST_TYPES_DEFAULT;
    }
    $common_tpl = 'archive-listing.php';
    $template   = $template_path . $common_tpl;
    include $template;
}
add_action( 'epl_render_archive_post', 'epl_render_archive_post' );

/**
 * Add extra class for twentysixteen theme
 *
 * @param string $class Class name.
 * @return string
 *
 * @since 3.0.0
 */
function epl_active_theme_name_twentysixteen( $class ) {

    if ( epl_get_active_theme() === 'twentysixteen' && ! is_single() ) {
        $class = $class . ' content-area';
    }
    return $class;
}
add_filter( 'epl_active_theme_name', 'epl_active_theme_name_twentysixteen' );
Easy Property Listings 3.5.15 Code Reference API documentation generated by ApiGen