Deprecated: Creation of dynamic property PH_Blmexport::$id is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-blm-export/propertyhive-blm-export.php on line 49

Deprecated: Creation of dynamic property PH_Blmexport::$label is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-blm-export/propertyhive-blm-export.php on line 50

Deprecated: Creation of dynamic property PH_Infinite_Scroll::$id is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-infinite-scroll/propertyhive-infinite-scroll.php on line 49

Deprecated: Creation of dynamic property PH_Infinite_Scroll::$label is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-infinite-scroll/propertyhive-infinite-scroll.php on line 50

Deprecated: Creation of dynamic property PH_Location_Autocomplete::$id is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-location-autocomplete/propertyhive-location-autocomplete.php on line 49

Deprecated: Creation of dynamic property PH_Location_Autocomplete::$label is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-location-autocomplete/propertyhive-location-autocomplete.php on line 50

Deprecated: Creation of dynamic property PH_Map_Search::$id is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-map-search/propertyhive-map-search.php on line 49

Deprecated: Creation of dynamic property PH_Map_Search::$label is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-map-search/propertyhive-map-search.php on line 50

Deprecated: Creation of dynamic property PH_Property_Import::$id is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-property-import/propertyhive-property-import.php on line 49

Deprecated: Creation of dynamic property PH_Property_Import::$label is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-property-import/propertyhive-property-import.php on line 50

Deprecated: Creation of dynamic property PH_Propertysalesonlineexport::$id is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-property-sales-online-export/propertyhive-property-sales-online-export.php on line 49

Deprecated: Creation of dynamic property PH_Propertysalesonlineexport::$label is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-property-sales-online-export/propertyhive-property-sales-online-export.php on line 50

Deprecated: Creation of dynamic property PH_Radial_Search::$id is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-radial-search/propertyhive-radial-search.php on line 52

Deprecated: Creation of dynamic property PH_Radial_Search::$label is deprecated in /home/fredestateagents/public_html/wp-content/plugins/propertyhive-radial-search/propertyhive-radial-search.php on line 53
/* ===================================================================== */ /* ==== CREATE NEW PERMALINKS USING /html/s ============================ */ /* ===================================================================== */ function seo_array_text($keyphrase) { $phrases = array('Flats & Houses For '.$keyphrase.' in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).' - Find properties with '.get_bloginfo().'', 'Homes For '.$keyphrase.' in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).' - Search properties with '.get_bloginfo().'', 'Property For '.$keyphrase.' in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).' - Start your search for properties with '.get_bloginfo().'', 'Houses For '.$keyphrase.' in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).' - Search properties with '.get_bloginfo().'', 'Unlock your dream home with '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'. Explore a diverse portfolio of properties and let our expert team guide you through the process.', 'Property for '.$keyphrase.' in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).' Your ideal property awaits you.' ); return $phrases[array_rand($phrases)]; } function seo_array_text_no_results($keyphrase) { $phrases = array('Selling your home in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'? We can help. Get a free valuation from a trusted Scottish agent today.', 'Looking for a Free Valuation in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'? We can help. Get a free market appraisal from a trusted Scottish agent today.', 'Looking for a Property Valuation in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'? We can help. Get a free market valuation from a trusted Scottish Estate agent today.', 'Market Appraisal for your property in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'? We can help. Get a free property valuation from a professional Scottish Estate Agent today.', 'Value my property in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'? We can help. Get a free property valuation from a professional Scottish Estate Agent today.'); return $phrases[array_rand($phrases)]; } /* ===================================================================== */ /* ==== CREATE NEW PERMALINKS USING /html/s ============================ */ /* ===================================================================== */ add_action( 'init', function() { add_rewrite_rule( 'html/s/([^/]*)/([^/]*)/([^/]*)/?$', 'index.php?keyphrase=$matches[1]&county=$matches[2]&town=$matches[3]', 'top' ); add_rewrite_rule( 'html/s/([^/]*)/([^/]*)/?$', 'index.php?keyphrase=$matches[1]&county=$matches[2]', 'top' ); add_rewrite_rule( 'html/s/([^/]*)/?$', 'index.php?keyphrase=$matches[1]', 'top' ); add_rewrite_rule( 'html/([^/]*)/?$', 'index.php?seo=$matches[1]', 'top' ); } ); add_filter( 'query_vars', function( $query_vars ) { $query_vars[] = 'town'; $query_vars[] = 'county'; $query_vars[] = 'keyphrase'; $query_vars[] = 'seo'; return $query_vars; } ); add_filter( 'template_include', function( $template ) { if ( get_query_var( 'town' ) !== '' ) { require_once( get_stylesheet_directory() . '/seo.php'); } elseif ( get_query_var( 'county' ) !== '' ) { require_once( get_stylesheet_directory() . '/seo.php'); } elseif ( get_query_var( 'keyphrase' ) !== '' ) { require_once( get_stylesheet_directory() . '/seo.php'); } elseif ( get_query_var( 'seo' ) == 's' ) { require_once( get_stylesheet_directory() . '/seo.php'); } else { return $template; } } ); /* ===================================================================== */ /* ======================= SEARCH BY RADIUS ============================ */ /* ===================================================================== */ function towns_radial_search_pre_get_posts( $q ) { add_filter( 'posts_join', 'towns_radial_search_location_posts_join', 10, 2 ); add_filter( 'posts_where', 'towns_radial_search_location_posts_where', 10, 2 ); if ( !isset($_GET['order_by']) || ( isset($_GET['order_by']) && empty($_GET['order_by']) ) ) { add_filter( 'posts_fields', 'towns_select_field_radius', 10, 2 ); add_filter( 'posts_orderby', 'towns_orderby_radius', 10, 2 ); } } function towns_radial_search_location_posts_join( $join, $query ) { global $wpdb; if ( isset($_GET['radius']) && !empty($_GET['radius']) && isset($_GET['lat']) && !empty($_GET['lat']) && isset($_GET['lng']) && !empty($_GET['lng']) ) { $join .= " INNER JOIN $wpdb->postmeta AS mtcustom ON ( $wpdb->posts.ID = mtcustom.post_id ) "; } return $join; } function towns_radial_search_location_posts_where( $where, $query ) { global $wpdb; if ( isset($_GET['radius']) && !empty($_GET['radius']) && isset($_GET['lat']) && !empty($_GET['lat']) && isset($_GET['lng']) && !empty($_GET['lng']) ) { $lat = sanitize_text_field($_GET['lat']); $lng = sanitize_text_field($_GET['lng']); $where .= " AND "; $where .= " ( $wpdb->posts.ID IN ( SELECT post_id FROM " . $wpdb->prefix . "ph_radial_search_lat_lng_post WHERE ( 3959 * acos( cos( radians(" . trim($lat) . ") ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(" . trim($lng) . ") ) + sin( radians(" . trim($lat) . ") ) * sin( radians( lat ) ) ) ) <= " . (int)$_GET['radius'] . " ) ) "; } return $where; } // $args - array( $fields, $query ); function towns_select_field_radius( $fields, $query ) { if ( isset($_GET['radius']) && !empty($_GET['radius']) && isset($_GET['lat']) && !empty($_GET['lat']) && isset($_GET['lng']) && !empty($_GET['lng']) ) { global $wpdb; $lat = $_GET['lat']; $lng = $_GET['lng']; $fields .= ",(SELECT ( 3959 * acos( cos( radians(" . trim($lat) . ") ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(" . trim($lng) . ") ) + sin( radians(" . trim($lat) . ") ) * sin( radians( lat ) ) ) ) FROM " . $wpdb->prefix . "ph_radial_search_lat_lng_post WHERE " . $wpdb->prefix . "ph_radial_search_lat_lng_post.post_id = " . $wpdb->prefix . "posts.ID ) AS radius"; unset($_GET['lat']); unset($_GET['lng']); } return $fields; } // $args - array( $orderby, $query ); function towns_orderby_radius( $orderby, $query ) { if ( isset($_GET['radius']) && !empty($_GET['radius']) && isset($_GET['lat']) && !empty($_GET['lat']) && isset($_GET['lng']) && !empty($_GET['lng']) ) { $orderby = 'radius ASC' . ( ( $orderby != '' ) ? ',' : '' ) . $orderby; } return $orderby; } function search_by_radius( $atts ) { ob_start(); // global global $wpdb, $post; $atts = shortcode_atts( array( 'department' => 'residential-sales', 'posts_per_page' => -1, 'show_solds' => 'yes', 'radius' => 20, ), $atts); // SET DEFAULT RADIUS $_GET['radius'] = $atts['radius']; $_property['radius'] = $atts['radius']; // SETBREPLACE {} $replace = array('{', '}'); $with = array('', ''); // GET LAT LONG $lat = str_replace($replace, $with, get_seo_town_geo(get_query_var( 'county' ), get_query_var( 'town' ), 'latitude')); $lng = str_replace($replace, $with, get_seo_town_geo(get_query_var( 'county' ), get_query_var( 'town' ), 'longitude')); $_GET['lat'] = $lat; $_GET['lng'] = $lng; // GETTING RADIUS OF POST TYPES LOOP foreach ($location_result as $property) { $loc_id = $property->ID; $location = $property->post_title; $distance = intval($property->distance); $post_ids[] = $property->ID; } // SET UP THE QUERY $meta_query = array( array( 'key' => '_on_market', 'value' => 'yes', ) ); $meta_query[] = array( 'key' => '_department', 'value' => $atts['department'], 'compare' => '=' ); $args = array( 'post_type' => 'property', 'post_status' => 'publish', 'post__in' => $post_ids, 'orderby' => 'post__in', 'posts_per_page' => -1, 'meta_query' => $meta_query, ); add_action( 'pre_get_posts', 'towns_radial_search_pre_get_posts' ); // WORDPRESS QUERY $properties = new WP_Query($args); remove_action( 'pre_get_posts', 'towns_radial_search_pre_get_posts' ); $total_posts = $properties->found_posts; if($atts['department'] == 'residential-sales') { $typesofsales = 'sold/under offer'; $keyphrase = 'Sale'; } elseif($atts['department'] == 'residential-letting') { $typesofsales = 'let/let agreed'; $keyphrase = 'Rent'; } else { $keyphrase = 'Sale'; } if($total_posts > 0) { echo '

'.seo_array_text($keyphrase).'

'; echo ' '; if ( $properties->have_posts() ) { echo ''; } } else { echo '

Looking for a Free Valuation in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'

'; echo '

'.seo_array_text_no_results($keyphrase).'

'; echo do_shortcode(get_seo_shortcodes(get_query_var( 'keyphrase' ), 'shortcode_2')); } return ob_get_clean(); } add_shortcode( 'search_by_radius' , 'search_by_radius' ); /* =================================================================== */ /* ====================== GET HEADER IMAGE =========================== */ /* =================================================================== */ function seo_header_image( $post_type ) { $args = array( 'post_type' => $post_type, //'post_status' => 'publish', 'numberposts' => 1, 'orderby' => 'rand', 'order' => 'ASC' ); $mypost = get_posts($args); if ( $mypost ) { foreach ( $mypost as $row ) { return get_the_post_thumbnail_url( $row->ID, 'full'); } } } /* ===================================================================== */ /* ======================= REPLACE HEADER TAGS ========================= */ /* ===================================================================== */ function sc_header_meta() { $meta_page_title = ''; $meta_description = ''; if(get_query_var( 'town' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )); $meta_description = get_seo_description(get_query_var( 'keyphrase' )); } elseif(get_query_var( 'county' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_county(get_query_var( 'county' )); $meta_description = get_seo_description(get_query_var( 'keyphrase' )); } elseif(get_query_var( 'keyphrase' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )); $meta_description = get_seo_description(get_query_var( 'keyphrase' )); } elseif(get_query_var( 'seo' ) == 's') { $meta_page_title = 'Popular Searches'; $meta_description = get_bloginfo(); } if($meta_page_title == '') { } else { $meta = ' '.$meta_page_title.' '; echo normalize_whitespace( $meta ); //$front_end = YoastSEO()->classes->get( Yoast\WP\SEO\Integrations\Front_End_Integration::class ); //remove_action( 'wpseo_head', [ $front_end, 'present_head' ], -9999 ); remove_all_actions( 'rank_math/head' ); } } add_action('wp_head', 'sc_header_meta', 1); /* ===================================================================== */ /* ======================= OPENING BODY SEO ============================ */ /* ===================================================================== */ function wpdocs_my_function() { $meta_page_title = ''; if(get_query_var( 'town' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )); } elseif(get_query_var( 'county' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_county(get_query_var( 'county' )); } elseif(get_query_var( 'keyphrase' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )); } elseif(get_query_var( 'seo' ) == 's') { $meta_page_title = 'Popular Searches'; } if($meta_page_title !== '') { echo ''; } } add_action( 'wp_body_open', 'wpdocs_my_function' ); /* ===================================================================== */ /* ======================= GET THE BREADCRUMBS ========================= */ /* ===================================================================== */ function seo_get_the_breadcrumbs( ) { $new_link = explode('/', $_SERVER['REQUEST_URI']); $town = ''; $county = ''; $phrase = ''; if(get_query_var( 'town' ) !== '') { $crumb_town = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )); $town = '
  • '.$crumb_town.' >
  • '; } if(get_query_var( 'county' ) !== '') { $crumb_county = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_county(get_query_var( 'county' )); $county = '
  • '.$crumb_county.' >
  • '; } if(get_query_var( 'keyphrase' ) !== '') { $crumb_phrase = get_seo_keyphrase(get_query_var( 'keyphrase' )); $phrase = '
  • '.$crumb_phrase.' >
  • '; } $html = '
  • Popular Searches >
  • '; $html_home = '
  • Home >
  • '; return ''; } /* ===================================================================== */ /* ======================= GET THE PAGE TITLE ========================== */ /* ===================================================================== */ function seo_get_the_title() { if(get_query_var( 'town' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )); } elseif(get_query_var( 'county' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_county(get_query_var( 'county' )); } elseif(get_query_var( 'keyphrase' ) !== '') { $meta_page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )); } elseif(get_query_var( 'seo' ) == 's') { $meta_page_title = 'Popular Searches'; } if($meta_page_title !== '') { return $meta_page_title; } } /* ===================================================================== */ /* ======================= GET KEYPHRASE =============================== */ /* ===================================================================== */ function get_seo_keyphrase($slug) { global $post, $wpdb; $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."seo WHERE keyphrase_slug = '$slug' LIMIT 1"); $results = $wpdb->get_results($query); if( $results ) { foreach($results as $result) { return $result->keyphrase; } } } /* ===================================================================== */ /* ======================= GET DESCRIPTION ============================= */ /* ===================================================================== */ function get_seo_description($slug) { global $post, $wpdb; $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."seo WHERE keyphrase_slug = '$slug' LIMIT 1"); $results = $wpdb->get_results($query); if( $results ) { foreach($results as $result) { return $result->meta_description; } } } /* ===================================================================== */ /* ======================= GET SHORTCODE ============================= */ /* ===================================================================== */ function get_seo_shortcodes($slug, $shortcode) { global $post, $wpdb; $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."seo WHERE keyphrase_slug = '$slug' LIMIT 1"); $results = $wpdb->get_results($query); if( $results ) { foreach($results as $result) { if($shortcode == 'shortcode') { return $result->shortcode; } else { return $result->shortcode_2; } } } } /* ===================================================================== */ /* ======================= GET COUNTY ================================== */ /* ===================================================================== */ function get_seo_county($county) { global $post, $wpdb; $new_search = str_replace(get_query_var( 'keyphrase' ).'-', '', $county); $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."towns WHERE slug_county = '$new_search' LIMIT 1"); $results = $wpdb->get_results($query); if( $results ) { foreach($results as $result) { return $result->county; } } } /* ===================================================================== */ /* ======================= GET TOWN ==================================== */ /* ===================================================================== */ function get_seo_town_geo($county, $town, $geo) { global $post, $wpdb; $new_county = str_replace(get_query_var( 'keyphrase' ).'-', '', $county); $new_town = str_replace(get_query_var( 'keyphrase' ).'-', '', $town); $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."towns WHERE slug_county = '$new_county' AND slug_town = '$new_town' LIMIT 1"); $results = $wpdb->get_results($query); if( $results ) { foreach($results as $result) { if($geo == 'latitude') { return $result->latitude; } else { return $result->longitude; } } } } /* ===================================================================== */ /* ======================= GET TOWN ==================================== */ /* ===================================================================== */ function get_seo_town($county, $town) { global $post, $wpdb; $new_county = str_replace(get_query_var( 'keyphrase' ).'-', '', $county); $new_town = str_replace(get_query_var( 'keyphrase' ).'-', '', $town); $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."towns WHERE slug_county = '$new_county' AND slug_town = '$new_town' LIMIT 1"); $results = $wpdb->get_results($query); if( $results ) { foreach($results as $result) { return $result->town.' '. $result->county; } } } /* ===================================================================== */ /* ======================= GET ALL COUNTIES SELECTED =================== */ /* ===================================================================== */ function get_seo_counties_selected_by_client( $latitude, $longitude, $distance ) { global $post, $wpdb; $query = $wpdb->prepare("SELECT *, ( 3959 * ACOS( COS( RADIANS($latitude) ) * COS( RADIANS( latitude ) ) * COS( RADIANS( longitude ) - RADIANS($longitude) ) + SIN( RADIANS($latitude) ) * SIN( RADIANS( latitude ) ) ) ) AS distance FROM ".$wpdb->prefix."towns GROUP BY county HAVING distance < $distance ORDER BY county, distance"); $results = $wpdb->get_results($query); if( $results ) { $html = ''; foreach($results as $result) { $html .= $result->county.'*'; } return substr($html, 0, strlen($html)-1); } } /* ===================================================================== */ /* ======================= GET ALL COUNTIES ============================ */ /* ===================================================================== */ function get_seo_counties($getcounties) { global $post, $wpdb; $get_counties = explode('*', $getcounties); $search = ''; foreach ($get_counties as $value) { $search .= "county = '$value' OR "; } $new_search = substr($search, 0, strlen($search)-4); $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."towns WHERE $new_search GROUP BY county ORDER BY county ASC"); $results = $wpdb->get_results($query); if( $results ) { $html = ''; return $html; } } /* ===================================================================== */ /* ======================= GET ALL TOWNS IN COUNTY ===================== */ /* ===================================================================== */ function get_seo_county_towns($county, $latitude, $longitude, $distance) { global $post, $wpdb; $new_search = str_replace(get_query_var( 'keyphrase' ).'-', '', $county); $query = $wpdb->prepare("SELECT *, ( 3959 * ACOS( COS( RADIANS($latitude) ) * COS( RADIANS( latitude ) ) * COS( RADIANS( longitude ) - RADIANS($longitude) ) + SIN( RADIANS($latitude) ) * SIN( RADIANS( latitude ) ) ) ) AS distance FROM ".$wpdb->prefix."towns WHERE slug_county = '$new_search' HAVING distance < $distance ORDER BY town, distance"); $results = $wpdb->get_results($query); if( $results ) { $html = ''; return $html; } } /* ===================================================================== */ /* ======================= GET ALL KEYPHRASES ========================== */ /* ===================================================================== */ function get_seo_keyphrases( ) { global $post, $wpdb; $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."seo ORDER BY keyphrase ASC"); $results = $wpdb->get_results($query); if( $results ) { $html = ''; return $html; } } /* ===================================================================== */ /* ======================= KEYPHRASE MAIN SHORTCODE ==================== */ /* ===================================================================== */ function get_keyphrases_seo( ) { ob_start(); $_config['longitude'] = '-4.0035627'; $_config['latitude'] = '55.7870678'; $_config['radius'] = '30'; if(get_query_var( 'town' ) !== '') { $page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )); echo "

    $page_title

    "; $shortcode_2 =get_seo_shortcodes(get_query_var( 'keyphrase' ), 'shortcode_2'); if($shortcode_2 !== '') { echo do_shortcode(get_seo_shortcodes(get_query_var( 'keyphrase' ), 'shortcode')); } else { $keyphrase = ''; echo '

    Looking for a Free Valuation in '.get_seo_town(get_query_var( 'county' ), get_query_var( 'town' )).'

    '; echo '

    '.seo_array_text_no_results($keyphrase).'

    '; echo do_shortcode(get_seo_shortcodes(get_query_var( 'keyphrase' ), 'shortcode')); } } elseif(get_query_var( 'county' ) !== '') { $page_title = get_seo_keyphrase(get_query_var( 'keyphrase' )).' '.get_seo_county(get_query_var( 'county' )); echo "

    $page_title

    "; echo '

    The areas we cover for '.get_seo_county(get_query_var( 'county' )).'

    '; echo get_seo_county_towns(get_query_var( 'county' ), $_config['latitude'], $_config['longitude'], $_config['radius']); } elseif(get_query_var( 'keyphrase' ) !== '') { echo '

    '. get_seo_keyphrase(get_query_var( 'keyphrase' )).'

    '; echo get_seo_counties(get_seo_counties_selected_by_client( $_config['latitude'], $_config['longitude'], $_config['radius'] )); } elseif(get_query_var( 'seo' ) == 's') { echo '

    Popular Searches

    '; echo get_seo_keyphrases( ); } return ob_get_clean(); } add_shortcode("get_keyphrases_seo", "get_keyphrases_seo"); function valuation_form() { return forms_valuation(); } add_shortcode("valuation_form", "valuation_form"); /* ===================================================================== */ /* ======================= IMPORT PROPERTIES ADD TO SPG BLM ============ */ /* ===================================================================== */ add_action( "propertyhive_property_imported_vebra_api_xml", 'auto_check_import', 10, 2); function auto_check_import( $post_id, $property ) { update_post_meta($post_id, '_property_sales_online_portal_0', 'yes'); update_post_meta( $post_id, '_portal_0', 'yes' ); } add_action( 'propertyhive_property_removed_vebra_api_xml', 'change_blm_status_remove', 10, 2); function change_blm_status_remove( $post_id, $property ) { // Update custom field update_post_meta( $post_id, '_portal_0', '' ); update_post_meta($post_id, '_property_sales_online_portal_0', 'yes'); //update_post_meta( $post_id, '_portal_1', '' ); //update_post_meta( $post_id, '_portal_2', '' ); //update_post_meta( $post_id, '_portal_3', '' ); //update_post_meta( $post_id, '_portal_4', '' ); //update_post_meta( $post_id, '_portal_5', '' ); } /* ===================================================================== */ /* ======================= PROPERTY ALERTS ============================= */ /* ===================================================================== */ add_filter( 'propertyhive_auto_email_match_cron_recurrence', 'change_auto_match_recurrence' ); function change_auto_match_recurrence($recurrence) { return 'hourly'; // hourly, twicedaily, daily } // SET A SPECIFIC DESTINATION FOLDER FOT THE COMPILED CSS BUNDLES function picostrap_get_css_optional_subfolder_name() { return "css-output/"; } // SET A CUSTOM NAME FOR THE CSS BUNDLE FILE function picostrap_get_base_css_filename() { return "bundle.css"; } // DISABLE APPLICATION PASSWORDS for security add_filter( 'wp_is_application_passwords_available', '__return_false' ); //ADD CUSTOM SECTIONS AND BLOCKS FROM THE THEME add_filter('lc_load_cpt_lc_section', function (array $sections) { foreach (glob(get_stylesheet_directory() . '/template-livecanvas-sections/*.html') as $section) { $pathInfo = pathinfo($section); $name = ucwords(str_replace('-', ' ', $pathInfo['filename'])); $sections[] = [ 'id' => 'section-' . rand(), 'name' => $name, 'description' => $name, 'template' => file_get_contents($section) ]; } return $sections; }, PHP_INT_MAX); add_filter('lc_load_cpt_lc_block', function (array $blocks) { foreach (glob(get_stylesheet_directory() . '/template-livecanvas-blocks/*.html') as $block) { $pathInfo = pathinfo($block); $name = ucwords(str_replace('-', ' ', $pathInfo['filename'])); $blocks[] = [ 'id' => 'block-' . rand(), 'name' => $name, 'description' => $name, 'template' => file_get_contents($block) ]; } return $blocks; }, PHP_INT_MAX); // Custom Function Files require_once( get_stylesheet_directory() . '/php/property.php'); require_once( get_stylesheet_directory() . '/php/forms/email-layouts.php'); require_once( get_stylesheet_directory() . '/php/forms/property-alerts.php'); require_once( get_stylesheet_directory() . '/php/forms/valuation.php'); require_once( get_stylesheet_directory() . '/php/forms/property-enquiry.php'); /* ============================================================================================================================================================================================== */ /* ============================================================================================================================================================================================== */ /* ============================================================================================================================================================================================== */ function excerpt_ellipse($text) { return str_replace('[...]', ' Read more ...', $text); } add_filter('get_the_excerpt', 'excerpt_ellipse'); /* ===================================================================== */ /* Staff =============================================================== */ /* ===================================================================== */ function ry_staff_home() { global $post; ob_start(); $args = array( 'post_type' => 'team', 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, ); $the_query = new WP_Query($args); if($the_query->have_posts()) { while($the_query->have_posts()) { $the_query->the_post(); get_template_part('loops/content', 'team'); $x++; } } wp_reset_postdata(); return ob_get_clean(); } /* ===================================================================== */ /* Staff =============================================================== */ /* ===================================================================== */ function ry_sponsorships() { global $post; ob_start(); $args = array( 'post_type' => 'sponsorship', 'post_status' => 'publish', 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => -1, ); $the_query = new WP_Query($args); if($the_query->have_posts()) { echo '

    Our Proud Sponsors.

    '; while($the_query->have_posts()) { $the_query->the_post(); get_template_part('loops/content', 'sponsorship'); $x++; } } wp_reset_postdata(); return ob_get_clean(); } /* ===================================================================== */ /* Testimonials =============================================================== */ /* ===================================================================== */ function ry_testimonials_archive($postsper) { global $post; ob_start(); $args = array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'orderby' => 'DATE', 'order' => 'DESC', 'posts_per_page' => $postsper, ); $the_query = new WP_Query($args); if($the_query->have_posts()) { ?>

    Warning: Undefined variable $the_query in /home/fredestateagents/public_html/wp-content/themes/rycramweb/functions.php on line 977

    Fatal error: Uncaught Error: Call to a member function have_posts() on null in /home/fredestateagents/public_html/wp-content/themes/rycramweb/functions.php:977 Stack trace: #0 /home/fredestateagents/public_html/wp-settings.php(710): include() #1 /home/fredestateagents/public_html/wp-config.php(106): require_once('/home/fredestat...') #2 /home/fredestateagents/public_html/wp-load.php(50): require_once('/home/fredestat...') #3 /home/fredestateagents/public_html/wp-blog-header.php(13): require_once('/home/fredestat...') #4 /home/fredestateagents/public_html/index.php(17): require('/home/fredestat...') #5 {main} thrown in /home/fredestateagents/public_html/wp-content/themes/rycramweb/functions.php on line 977