PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 1.4.62 All 260 releases
propertyhive / includes / ph-conditional-functions.php

ph-conditional-functions.php in Property Hive 2.3.0, at includes/ph-conditional-functions.php

67 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PropertyHive Conditional Functions
4 *
5 * Functions for determining the current query/page.
6 *
7 * @author PropertyHive
8 * @category Core
9 * @package PropertyHive/Functions
10 * @version 1.0.0
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15 /**
16 * is_propertyhive - Returns true if on a page which uses PropertyHive templates
17 *
18 * @access public
19 * @return bool
20 */
21 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper is_propertyhive; the established callable name is part of the plugin/extension API and must remain stable.
22 function is_propertyhive() {
23 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Existing public Property Hive extension hook is_propertyhive; changing the established name would detach installed callbacks.
24 return apply_filters( 'is_propertyhive', ( is_search_results() || is_property() ) ? true : false );
25 }
26
27 if ( ! function_exists( 'is_search_results' ) ) {
28
29 /**
30 * is_search_results - Returns true when viewing the property archive (search results).
31 *
32 * @access public
33 * @return bool
34 */
35 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper is_search_results; the established callable name is part of the plugin/extension API and must remain stable.
36 function is_search_results() {
37 return ( is_post_type_archive( 'property' ) || is_page( ph_get_page_id( 'search_results' ) ) ) ? true : false;
38 }
39 }
40
41 if ( ! function_exists( 'is_property' ) ) {
42
43 /**
44 * is_product - Returns true when viewing a single product.
45 *
46 * @access public
47 * @return bool
48 */
49 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper is_property; the established callable name is part of the plugin/extension API and must remain stable.
50 function is_property() {
51 return is_singular( array( 'property' ) );
52 }
53 }
54
55 if ( ! function_exists( 'is_ajax' ) ) {
56
57 /**
58 * is_ajax - Returns true when the page is loaded via ajax.
59 *
60 * @access public
61 * @return bool
62 */
63 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper is_ajax; the established callable name is part of the plugin/extension API and must remain stable.
64 function is_ajax() {
65 return defined( 'DOING_AJAX' );
66 }
67 }