Skip to content

Instantly share code, notes, and snippets.

View fahidjavid's full-sized avatar
🎯
Focusing

Fahid Javid fahidjavid

🎯
Focusing
View GitHub Profile
<?php
/**
* Disable debug mode for the local WP installation created by "Local by Flywheel" application.
**/
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
@fahidjavid
fahidjavid / ajaxurl-use-example.js
Created December 16, 2020 09:14
ajaxurl JS variable can be used for the WP admin ajax URL in any JS file of the RealHomes theme now.
var add_to_favorite_options = {
type : 'post',
url : ajaxurl, // This is how we can use the 'ajaxurl' variable for the WordPress ajax URL.
data : {
action: 'add_to_favorite',
property_id : propertyID,
},
success: function(response) {
if('false' !== response) {
$(favorite_link).addClass('hide');
<?php
class A {
public function __construct() {
echo "Hello from first class file.";
}
}
<?php
function inspiry_add_user_additional_fields() {
$form_fields = array(
array(
'name' => esc_html__( 'Postal Code', 'framework' ),
'id' => 'postal_code',
'type' => 'select',
'options' => array(
@fahidjavid
fahidjavid / google-maps-address-lat-lng.php
Created December 12, 2018 07:03
Getting the Google Maps Latitude and Longitude of an Address
<?php
$address = 'Visalia, CA, USA'; // any address you want latitude and longitude of
$address_encoded = urlencode($address);
$url = "https://maps.googleapis.com/maps/api/geocode/json?address=". $address_encoded ."&key=YOUR_API_KEY";
$result = file_get_contents($url);
$geocode = json_decode($result, true); // returing json of all information about given address
$location = $geocode['results'][0]['geometry']['location'];
@fahidjavid
fahidjavid / sshmp.html
Created August 10, 2018 16:45
Simple Static HTML Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@fahidjavid
fahidjavid / bootstrap-mq-bp.scss
Last active August 14, 2018 08:05
Bootstrap Sass Media Query Variables
//== Media queries breakpoints
// Extra small screen / phone
$screen-xs: 480px;
$screen-xs-min: $screen-xs;
// Small screen / tablet
$screen-sm: 768px;
$screen-sm-min: $screen-sm;
@fahidjavid
fahidjavid / enter-title-here.php
Created May 18, 2018 07:49
Replace "Enter Title Here" placeholder text
<?php
function PREFIX_change_title_text( $title ){
$screen = get_current_screen();
if ( 'events' == $screen->post_type ) { // Replace 'events' with key of your custom post type
$title = 'Enter event name with date';
}
return $title;
@fahidjavid
fahidjavid / form-validate-ajax-call.js
Last active January 21, 2020 08:43
A WordPress standard contact form and its request mail handler.
/*----------------------------------------------------------------------------------*/
/* Contact Form AJAX validation and submission
/* Validation Plugin : http://bassistance.de/jquery-plugins/jquery-plugin-validation/
/* Form Ajax Plugin : http://www.malsup.com/jquery/form/
/*---------------------------------------------------------------------------------- */
if (jQuery().validate && jQuery().ajaxSubmit) {
var submitButton = $('#submit-button'),
ajaxLoader = $('#ajax-loader'),
messageContainer = $('#message-container'),
@fahidjavid
fahidjavid / country-codes-array.php
Created September 14, 2017 13:36
Array of country codes
<?php
$countries = array (
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',