Skip to content

Instantly share code, notes, and snippets.

View sungraizfaryad's full-sized avatar

SUNGRAIZ FARYAD sungraizfaryad

View GitHub Profile
<?php
function inspiry_readable_price_format($price){
// first strip any formatting;
$price = (0+str_replace(",","",$price));
// now filter it;
if($price>1000000000000){
$price = round(($price/1000000000000),1). esc_html__(' T', 'easy-real-estate');
}
@sungraizfaryad
sungraizfaryad / remove-tax-name-from-url.php
Created October 9, 2019 10:39
Remove Taxonomies name from URL.
<?php
function inspiry_remove_tax_slugs($query_vars){
// Add the slugs of those taxonomies which you want to remove from url.
$tax_slugs = array('property-type','property-status','property-city');
if( isset($query_vars['attachment']) ? $query_vars['attachment'] : null) :
$include_children = true;
$name = $query_vars['attachment'];
var shareButtonLabel = $('#share-button-title').text(),
propertyTitle = $('.rh_page__title').text(),
propertyThumbnail = $('.only-for-print img').attr('src'),
propertyDescription = $.trim($('.property_description p:first').text()),
descriptionTextLength = 100, // Description Test Lenght for Social Media
descriptionTextLabel = 'Property URL'; // Label for URL you'd like to share via email
$(window).on('load', function (event) {
var shareThisProperty = $('.share-this');
var linkedin = '<li class="entypo-facebook entypo-linkedin" style="background: #4875b4;"><div id="share-this-property-linkedin" style="position: absolute; top: 0;left: 0;right: 0;bottom: 0; display: block;"></div></li>';
shareThisProperty.find('ul').append(linkedin);
<style>
/* Child Theme - Custom CSS File for Buyers to Modify */
.wp-customizer .wp-picker-input-wrap .button, .wp-picker-input-wrap .button {
width: auto;
display: inline-block;
background: #ea723d !important;
color: #fff !important;
border: 0 !important;
}
.wp-picker-container .wp-color-result.button{
@sungraizfaryad
sungraizfaryad / additional-meta-box.php
Last active October 31, 2019 17:19
You can create additional metabox and display them on frontend.
Class Inspiry_Additional_Meta_Fields_Builder {
public static $_instance;
public $meta_box_data;
function __construct(){
$this->meta_box_data = $this->inspiry_get_meta_box_value_array();
@sungraizfaryad
sungraizfaryad / validate.js
Last active August 17, 2019 17:26
You can use these methods to block any email extension and it can also prevent users to add URL in textarea field.
// Block ru extention in email like www.google.ru
$.validator.addMethod("noRu", function(value, element) {
return (this.optional(element) || value.slice(-3) != ".ru");
}, "The .ru extention is not allowed in email address");
// Prevent users to add any URL in textarea
$.validator.addMethod("noUrl", function(value, element) {
return (this.optional(element) || value.match(/\b(http|https)?(:\/\/)?(\S*)\.(\w{2,4})(.*)/g) == null);