示例#1
0
<?php

// Load js
add_action("wp_enqueue_scripts", function () {
    $template_part = \Vividcrestrealestate\Core\Router::definePart();
    // Fetch Google API key
    $key = get_option("rets_connection_google_api_key", "");
    $key_url_part = !empty($key) ? "key={$key}&" : "";
    if ($template_part == "map") {
        // Load Google Maps Api Library
        wp_enqueue_script("google-maps-api", "https://maps.googleapis.com/maps/api/js?{$key_url_part}libraries=places,drawing,geometry");
        // Load clusteriztion library
        wp_enqueue_script("google-maps-clusterization", "https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer_compiled.js");
        // Load handlers
        wp_enqueue_script("vividcrest-google-map-autocomplete", get_template_directory_uri() . "/js/handlers/google_map_autocomplete.js", ["jquery"]);
        wp_enqueue_script("vividcrest-properties-sort", get_template_directory_uri() . "/js/properties/map.js", ["jquery"]);
        wp_enqueue_script("vividcrest-handlers-view_toggle", get_template_directory_uri() . "/js/handlers/view_toggle.js", ["jquery"]);
    } elseif ($template_part == "properties") {
        // Load Google Maps Api Library
        wp_enqueue_script("google-maps-api", "https://maps.googleapis.com/maps/api/js?{$key_url_part}libraries=places,drawing,geometry");
        // Load lib for cookie
        wp_enqueue_script("jquery-cookies", get_template_directory_uri() . "/js/libs/jquery.cookie.js", ["jquery"]);
        // Load lib for url params
        wp_enqueue_script("url-params", get_template_directory_uri() . "/js/libs/url_params.js");
        wp_enqueue_script("vividcrest-properties-compare", get_template_directory_uri() . "/js/properties/compare.js", ["jquery"]);
        wp_enqueue_script("vividcrest-properties-sort", get_template_directory_uri() . "/js/properties/sort.js", ["jquery", "url-params"]);
        wp_enqueue_script("vividcrest-google-map-autocomplete", get_template_directory_uri() . "/js/handlers/google_map_autocomplete.js", ["jquery"]);
        wp_enqueue_script("vividcrest-handlers-view_toggle", get_template_directory_uri() . "/js/handlers/view_toggle.js", ["jquery"]);
    } elseif ($template_part == "property") {
        // Datepicker for forms
        wp_enqueue_style("vividcrest-jquery-ui", "//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css");
示例#2
0
<?php

$part = \Vividcrestrealestate\Core\Router::definePart();
$data = \Vividcrestrealestate\Core\Router::loadData($part);
?>
<!doctype html>
<html lang=ru>
<head>
	<meta charset=utf-8>
	<title> </title>
	<link rel="stylesheet" href="<?php 
echo get_template_directory_uri();
?>
/style.css" />
	<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,700' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="<?php 
echo get_template_directory_uri();
?>
/css/responsive.css" />
	<link rel="stylesheet" href="<?php 
echo get_template_directory_uri();
?>
/css/header.css" />
	<link rel="stylesheet" href="<?php 
echo get_template_directory_uri();
?>
/css/sections.css" />
	<link rel="stylesheet" href="<?php 
echo get_template_directory_uri();
?>