'property', 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_on_market', 'value' => 'yes' ), array( 'key' => '_featured', 'value' => 'yes' ) ), 'fields' => 'id=>parent' ) ); $featured_property_ids = array_keys( $featured ); set_transient( 'ph_featured_properties', $featured_property_ids, YEAR_IN_SECONDS ); return $featured_property_ids; } /** * Get the placeholder image URL for properties * * @access public * @return string */ function ph_placeholder_img_src() { return apply_filters( 'propertyhive_placeholder_img_src', PH()->plugin_url() . '/assets/images/placeholder.png' ); } /** * Get the placeholder image * * @access public * @return string */ function ph_placeholder_img( $size = 'thumbnail' ) { $dimensions = ph_get_image_size( $size ); return apply_filters('propertyhive_placeholder_img', 'Placeholder' ); } /** * Track property views */ function ph_track_property_view() { if ( ! is_singular( 'property' ) ) return; global $post; // Track in cookie if ( apply_filters( 'propertyhive_store_in_recently_viewed_cookie', true ) ) { if ( empty( $_COOKIE['propertyhive_recently_viewed'] ) ) $viewed_properties = array(); else $viewed_properties = (array) explode( '|', $_COOKIE['propertyhive_recently_viewed'] ); if ( ! in_array( $post->ID, $viewed_properties ) ) $viewed_properties[] = $post->ID; if ( sizeof( $viewed_properties ) > 15 ) array_shift( $viewed_properties ); // Store for session only ph_setcookie( 'propertyhive_recently_viewed', implode( '|', $viewed_properties ) ); } // Track in database if ( !is_user_logged_in() || ( is_user_logged_in() && !current_user_can('manage_propertyhive') ) ) { // User isn't logged in $view_counts = get_post_meta( $post->ID, '_view_statistics', TRUE ); if ( $view_counts == '' || !is_array($view_counts) ) { $view_counts = array(); } if ( !isset($view_counts[date("Y-m-d")]) ) { $view_counts[date("Y-m-d")] = 0; } ++$view_counts[date("Y-m-d")]; update_post_meta( $post->ID, '_view_statistics', $view_counts ); } } add_action( 'template_redirect', 'ph_track_property_view', 20 ); function get_property_map( $args = array() ) { global $property; if ( $property->latitude != '' && $property->latitude != '0' && $property->longitude != '' && $property->longitude != '0' ) { $api_key = get_option('propertyhive_google_maps_api_key'); wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3'); wp_enqueue_script('googlemaps'); $id_suffix = ( ( isset($args['id']) && $args['id'] != '' ) ? '_' . $args['id'] : '' ); echo '
'; ?> latitude != '' && $property->latitude != '0' && $property->longitude != '' && $property->longitude != '0' ) { $api_key = get_option('propertyhive_google_maps_api_key'); wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3'); wp_enqueue_script('googlemaps'); echo '
'; ?>