<?php



/*

 * Real Connect Start Session function strat 

 */ 

function realConnectStartSession() {

    if(!session_id()) {

        session_start();

    }

}

add_action('init', 'realConnectStartSession');







/*

 * Wppage function strat 

*/ 

function wppage($rc_listing_view_template_file_path = '') {

	global $wp;



			$pageurl =  get_permalink();

			

			

			$pageurl_uri =  str_replace(get_site_url(),"",$pageurl);

			$pageurl_uri = ltrim($pageurl_uri, '/');

			$pageurl_uri = rtrim($pageurl_uri, '/');

			



			// added by vikas on 2 apr 2020

			$pageurl_uri=$wp->request;







			$searchpos = strpos($pageurl,'searchrc');



			$pos = strpos($pageurl,'listings');

			

                global $post;

				$map = get_post_meta($post->ID,'map',true);

				$special = get_post_meta($post->ID,'special',true);

				$sort_term = get_post_meta($post->ID,'sort_term',true);

				

				if(isset($_POST['sort_term'])){

					$sort_term = $_POST['sort_term'];

				}

				if(isset($_POST['special'])){

					$special = $_POST['special'];

				}

				if(isset($_POST['map'])){

					$map = $_POST['map'];

				}

				

				

				if(empty($map)){

					

					 $pagination_start_no = get_query_var( 'page', 1 ); 

					 if(is_numeric($pagination_start_no) && ($pagination_start_no != 0)){

						 $map = $pagination_start_no;

					 }

				} 

				

				unset($_SESSION['main_search']);

				unset($_SESSION['property_type']);

				//$_SESSION['selectednew'];

				$_SESSION['referer'] = $pageurl_uri ;

				properties($map,$special,$sort_term,$rc_listing_view_template_file_path);

				

			

		

}





?>

