Skip to content

Instantly share code, notes, and snippets.

View talentedaamer's full-sized avatar
🎯
WordPress, Laravel, JavaScript, Angular

Aamer Shahzad talentedaamer

🎯
WordPress, Laravel, JavaScript, Angular
View GitHub Profile
@talentedaamer
talentedaamer / component-file.js
Last active February 3, 2019 19:25
Usage of strUcWords function.
/**
* import helper functions
*/
import { strUcWords } from './helper-functions';
let str = strUcWords( 'hello world in lowercase' );
// output : 'Hello World In Lowercase'
@talentedaamer
talentedaamer / helper-functions.js
Last active February 3, 2019 19:21
ucWords in JavaScript.
/**
* uppercase words in string.
*
* @param str
* @returns {string}
*/
export function strUcWords ( str ) {
return ( str + '' ).replace(/\b[a-z]/g, function (letter) {
return letter.toUpperCase()
})
@talentedaamer
talentedaamer / plugin_or_theme_functions.php
Last active September 3, 2018 06:59
add custom column content to taxonomy (carousel_category) list table page.
<?php
/*
* filter pattern: manage_{taxonomy}_custom_column
* where {taxonomy} is the name of taxonomy e.g; 'carousel_category'
* codex ref: https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_$taxonomy_id_columns
*/
add_filter( 'manage_carousel_category_custom_column', 'wptc_carousel_category_column_content', 10, 3 );
function wptc_carousel_category_column_content( $content, $column_name, $term_id ) {
// get the term object
$term = get_term( $term_id, 'carousel_category' );
@talentedaamer
talentedaamer / plugin_or_theme_functions.php
Last active September 3, 2018 06:59
add custom column to taxonomy (carousel_category) list table page.
<?php
/*
* filter pattern: manage_edit-{taxonomy}_columns
* where {taxonomy} is the name of taxonomy e.g; 'carousel_category'
* codex ref: https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_$taxonomy_id_columns
*/
add_filter( 'manage_edit-carousel_category_columns' , 'wptc_carousel_category_columns' );
function wptc_carousel_category_columns( $columns ) {
// remove slug column
unset($columns['slug']);
@talentedaamer
talentedaamer / custom_cron_scedule_intervals.php
Last active July 31, 2018 07:33
add custom weekly, monthly and 30 minutes cron time schedules via cron_schedules filter hook
<?php
function wptc_add_intervals( $schedules ) {
// add a 'weekly' interval
if( ! isset( $schedules['weekly'] ) ) {
$schedules['weekly'] = array(
'interval' => 604800, // seconds in a week
'display' => __('Once Weekly')
);
}
// add a 'monthly' interval
@talentedaamer
talentedaamer / custom_cron_scedule_time.php
Last active July 31, 2018 07:26
Create new schedule times via 'cron_schedules' filter hook
<?php
// using 30min time interval
wp_schedule_event( time(), '30min', 'wptc_custom_schedule_hook', $args );
// using weekly time interval
wp_schedule_event( time(), 'weekly', 'wptc_custom_schedule_hook', $args );
// using monthly time interval
wp_schedule_event( time(), 'montly', 'wptc_custom_schedule_hook', $args );
@talentedaamer
talentedaamer / brain-coordinates
Last active April 24, 2018 09:03
brain graph co ordinates
x,y,z,i,o,name,color
-38.65,-5.68,50.94,0,1,Precentral-L,red
41.37,-8.21,52.09,0,1,Precentral-R,red
-18.45,34.81,42.2,0,1,Frontal-Sup-L,blue
21.9,31.12,43.82,0,1,Frontal-Sup-R,blue
-16.56,47.32,-13.31,0,1,Frontal-Sup-Orb-L,orange
18.49,48.1,-14.02,0,1,Frontal-Sup-Orb-R,orange
-33.43,32.73,35.46,0,1,Frontal-Mid-L,green
37.59,33.06,34.04,0,1,Frontal-Mid-R,green
-30.65,50.43,-9.62,0,1,Frontal-Mid-Orb-L,blue
<div id="wrapper" class="properties-filter">
<div class="container">
<h1 class="section-heading text-center upper color-blue mb-30 font-48">Available Properties</h1>
<nav class="primary clearfix">
<ul class="properties-filter-menu list-inline mb-30">
<?php
$args = array(
'orderby' => 'name',
'order' => 'ASC',
@talentedaamer
talentedaamer / gist:8813f7031877be14836e
Last active November 26, 2015 05:28
enqueue isotope js and custom js functions file.
<?php
/**
* Theme Directories & Paths
* ===================================
*/
if (!defined('FRAMEWORK_DIR'))
define('FRAMEWORK_DIR', trailingslashit(get_template_directory()));
if (!defined('FRAMEWORK_URI'))
define('FRAMEWORK_URI', trailingslashit(get_template_directory_uri()));
@talentedaamer
talentedaamer / gist:d35469ba928224c72207
Created November 26, 2015 05:10
custom functions to call JavaScript and jQuery functions and plugins.
/**
* custom js functions
*/
jQuery(function ($) {
// filterable properties.
var $container = $('.properties');
$container.isotope({
filter: '*',
animationOptions: {