Skip to content

Instantly share code, notes, and snippets.

Saqib Sarwar saqibsarwar

Block or report user

Report or block saqibsarwar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@saqibsarwar
saqibsarwar / functions.php
Last active Mar 4, 2019
add new enquiry support to Real Homes CRM
View functions.php
function add_new_enquiry_support( $args ) {
$args['capabilities'] = array(
'create_posts' => true,
);
return $args;
}
add_filter( 'recrm_enquiry_post_type_args', 'add_new_enquiry_support' );
@saqibsarwar
saqibsarwar / functions.php
Created Feb 26, 2019
Add Post Views Counter Colunn to Properties
View functions.php
function add_property_views_column( $columns ) {
$columns['post_views'] = '<span class="dash-icon dashicons dashicons-chart-bar" title="' . __( 'Post Views', 'framework' ) . '"></span><span class="dash-title">' . __( 'Post Views', 'framework' ) . '</span>';
return $columns;
}
add_filter( 'manage_edit-property_columns', 'add_property_views_column', PHP_INT_MAX );
@saqibsarwar
saqibsarwar / change-log.txt
Last active Oct 14, 2019
Real Homes Change Log
View change-log.txt
Change Log - Real Homes Theme
=============================
--------------
Version 3.9.6
--------------
Fixed - Virtual tour iframe embed code's sanitization issue.
--------------
View gutenberg-sample-content.html
<!-- wp:paragraph {"align":"center","textColor":"heading-link-color-mako","customBackgroundColor":"#e8eaeb","fontSize":"large"} -->
<p style="background-color:#e8eaeb;text-align:center" class="has-text-color has-background has-large-font-size has-heading-link-color-mako-color"><strong>Gutenberg Sample Content</strong></p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>
@saqibsarwar
saqibsarwar / functions.php
Created Aug 30, 2018
Adding REST API Support for Property CPT and Related Taxonomies
View functions.php
/**
* Add REST API support for property
*/
add_action( 'init', 'property_rest_support', 25 );
function property_rest_support() {
global $wp_post_types;
$post_type_name = 'property';
if( isset( $wp_post_types[ $post_type_name ] ) ) {
$wp_post_types[$post_type_name]->show_in_rest = true;
@saqibsarwar
saqibsarwar / functions.php
Created Sep 28, 2017
Load trnalstion from child theme for Real Homes
View functions.php
if ( !function_exists( 'inspiry_load_translation_from_child' ) ) {
/**
* Load translation files from child theme
*/
function inspiry_load_translation_from_child() {
load_child_theme_textdomain ( 'framework', get_stylesheet_directory () . '/languages' );
}
add_action ( 'after_setup_theme', 'inspiry_load_translation_from_child' );
@saqibsarwar
saqibsarwar / property-slider.php
Created Sep 1, 2016
temp solution for WPML clients with no workflow
View property-slider.php
global $post;
$inspiry_current_property_id = $post->ID;
// if WPML is being used
if ( function_exists( 'wpml_get_default_language_filter' ) ) {
$our_default_language = apply_filters( 'wpml_default_language', null );
// Get the original property id to display gallery images properly
$inspiry_current_property_id = apply_filters( 'wpml_object_id', $inspiry_current_property_id, 'property', true, $our_default_language );
}
View add_google_maps_key.php
if ( ! function_exists( 'inspiry_google_maps_api_key' ) ) :
/**
* This function adds API key ( if provided in settings ) to google maps arguments
*/
function inspiry_google_maps_api_key( $google_map_arguments ) {
/* Get Google Maps API Key if available */
$google_maps_api_key = get_option( 'inspiry_google_maps_api_key' );
if ( ! empty( $google_maps_api_key ) ) {
$google_map_arguments[ 'key' ] = urlencode( $google_maps_api_key );
View google_maps_api_key.php
/* Google Maps API Key */
$wp_customize->add_setting( 'inspiry_google_maps_api_key', array(
'type' => 'option',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( 'inspiry_google_maps_api_key', array(
'label' => __( 'Google Maps API Key', 'framework' ),
'type' => 'text',
'section' => 'inspiry_misc_section',
) );
View inspiry-get-terms-array.php
<?php
function inspiry_get_terms_array( $tax_name, &$terms_array ) {
$tax_terms = get_terms( array(
'taxonomy' => $tax_name,
'hide_empty' => true,
) );
inspiry_add_term_children( 0, $tax_terms, $terms_array );
}
You can’t perform that action at this time.