Skip to content

Instantly share code, notes, and snippets.

protected $table = 'listings_specifications';
public function listings()
{
return $this->BelongsTo('listings');
}
$listing = new Listing;
$contact = new Contact;
$listing->status = Input::get('status');
$listing->listingfor = Input::get('listingfor');
$listing->propertystatus = Input::get('propertystatus');
$listing->propertytype = Input::get('propertytype');
$listing->userid = Auth::user()->id;
$listing->reference_id = Input::get('reference_id');
$listing->location = Input::get('location');
$listing->lifestyle = Input::get('lifestyle');
$listing = new Listing;
$contact = new Contact;
$listing->status = Input::get('status');
$listing->listingfor = Input::get('listingfor');
$listing->propertystatus = Input::get('propertystatus');
$listing->propertytype = Input::get('propertytype');
$listing->userid = Auth::user()->id;
$listing->reference_id = Input::get('reference_id');
$listing->location = Input::get('location');
$listing->lifestyle = Input::get('lifestyle');
@wpconsulate
wpconsulate / google-maps-distance-between-2-points.html
Created September 11, 2019 08:12
HTML Example to Calculate Distance Between 2 Points- Google Maps V3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
@wpconsulate
wpconsulate / gmap-distance-between-points.js
Created September 11, 2019 08:14
Google Maps V3 JS API to Calculate Distance Between 2 points
var rad = function(x) {
return x * Math.PI / 180;
};
var getDistance = function(p1, p2) {
var R = 6378137; // Earth’s mean radius in meter
var dLat = rad(p2.lat() - p1.lat());
var dLong = rad(p2.lng() - p1.lng());
@wpconsulate
wpconsulate / remove-mac-sysfiles.sh
Created September 13, 2019 11:36
Remove Mac System Files __MACOSX or .DS_Store from a folder or Git Repo
#!/bin/bash
# remove __MACOSX foldr and .DS_Store files
# from *_original.zip file
# zip again and place under fixed/*
for x in $*
do
unzip $x
@wpconsulate
wpconsulate / gotham.md
Created January 13, 2020 07:51 — forked from mfd/ gotham.md
Gotham font
https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css

<link rel="https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css">

@wpconsulate
wpconsulate / customplugin.php
Last active March 11, 2020 09:37
Wordpress Activation Email Subject + Contents Update
<?php
/*
* Change the Subject of the Email Confirmation Email sent to user
*/
add_filter ( 'wppb_signup_user_notification_email_subject', 'wppbc_custom_email_confirmation_subject', 20, 8 );
function wppbc_custom_email_confirmation_subject($subject, $user_email, $user, $activation_key, $registration_page_url, $meta, $from_name, $context ){
// $default_message = sprintf( __( '[%1$s] Activate %2$s', 'profile-builder'), $from_name, $user );
$new_message = sprintf( __( '[%1$s] Activate your account', 'profile-builder'), $from_name);
return $new_message;
<?php
class WP_REST_API_Sample extends WP_REST_Controller {
function __construct(){
add_action( 'rest_api_init', array($this, 'register_routes') );
}
/**
* Register the routes for the objects of the controller.
@wpconsulate
wpconsulate / get-order-info.txt
Created April 30, 2020 01:52
WooCommerce: Get Order Info (total, items, etc) from $order Object
1. You have access to $order variable
Hooks (do_action and apply_filters) use additional arguments which are passed on to the function. If they allow you to use the “$order” object you’re in business. Here’s how to get all the order information:
// Get Order ID and Key
$order->get_id();
$order->get_order_key();
// Get Order Totals $0.00
$order->get_formatted_order_total();
$order->get_cart_tax();