Skip to content

Instantly share code, notes, and snippets.

<?php
function inspiry_top_properties_widgets() {
?>
<div class="col-sm-12">
<div class="widget-common widget-small inspiry-top-properties-wrapper clearfix">
<div class="widget-body clearfix">
<h4 class="text-center"><?php esc_html_e( 'Top Visited Properties of this Month', 'framework' ); ?></h4>
<div id="inspiry-top-properties" class="clearfix" style="height: 400px; width: 100%;"></div>
</div>
@sungraiz
sungraiz / functions.php
Created May 13, 2020 20:57
Replace Property Slug With Taxonomy
<?php
add_filter('post_link', 'inspiry_post_type_permalink', 20, 3);
add_filter('post_type_link', 'inspiry_post_type_permalink', 20, 3);
function inspiry_post_type_permalink($permalink, $post_id, $leavename) {
$post_type_name = 'property'; // post type name, you can find it in admin area or in register_post_type() function
$post_type_slug = 'property'; // the part of your product URLs, not always matches with the post type name
$tax_name = 'property-status'; // the product categories taxonomy name
/* Child Theme - Custom JS File for Users to add their own JS code */
(function($){
function equalHeights(){
// Select and loop the container element of the elements you want to equalise
$(document).find('.rh_latest-properties.rhea_properties_default').each(function(){
// Cache the highest
var highestBox = 0;
@sungraiz
sungraiz / agents-sorting.php
Created March 3, 2020 10:05
Agents Sorting
<div class="rh_page__head">
<div class="rh_page__controls">
<div class="rh_sort_controls">
<select name="sort-properties" id="sort-properties" class="rh_select2">
<option value="default" <?php echo ( !isset($_GET['sortby'])) ? 'selected' : ''; ?>><?php esc_html_e('Default Order', 'framework'); ?></option>
<option value="title" <?php echo ( isset($_GET['sortby']) && 'title' === $_GET['sortby'] ) ? 'selected' : ''; ?>><?php esc_html_e('Agent Name', 'framework'); ?></option>
<option value="total-asc" <?php echo ( isset($_GET['sortby']) && 'total-asc' === $_GET['sortby'] ) ? 'selected' : ''; ?>><?php esc_html_e('Total Properties (ASC)', 'framework'); ?></option>
<option value="pub-asc" <?php echo ( isset($_GET['sortby']) && 'pub-asc' === $_GET['sortby'] ) ? 'selected' : ''; ?>><?php esc_html_e('Published Properties (ASC)', 'framework'); ?></option>
</select>
</div>
// Create the autocomplete object, restricting the search predictions to
// geographical location types.
var autocomplete = new google.maps.places.Autocomplete(
document.getElementById(addressField), {types: ['geocode']});
// Avoid paying for data that you don't need by restricting the set of
// place fields that are returned to just the address components.
autocomplete.setFields(['geometry']);
// When the user selects an address from the drop-down, populate the
<style>
.rh_form__item #attachment-thumbs-container {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
/**
* Javascript to handle open street map for multiple properties
*/
jQuery( function( $ ) {
'use strict';
if ( typeof propertiesMapData !== "undefined" ) {
if ( 0 < propertiesMapData.length ) {
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}
.leaflet-cluster-spider-leg {
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
/*
Leaflet.markercluster, Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
https://github.com/Leaflet/Leaflet.markercluster
(c) 2012-2013, Dave Leaver, smartrak
*/
(function (window, document, undefined) {/*
* L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
*/
L.MarkerClusterGroup = L.FeatureGroup.extend({
@sungraiz
sungraiz / submit-google-map.js
Last active October 16, 2019 14:47
Now user can search by both coordinates and address.
if((/[a-z]/i.test(address))){
this.geocoder.geocode({'address': address}, function (results, status)
{
if ( status == window.google.maps.GeocoderStatus.OK )
{
that.updatePositionInput(results[0].geometry.location);
that.marker.setPosition(results[0].geometry.location);
that.map.setCenter(that.marker.position);
that.map.setZoom(15);