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 / gist:81574d819c34fe3fd2de
Last active November 24, 2015 11:35
Right way to use <title> tags in WordPress themes. add_theme_support( 'title-tag' );
<?php
/*
* call the oopthemes_after_setup function when theme is initialized.
*/
add_action( 'after_setup_theme', 'oopthemes_after_setup' );
function oopthemes_after_setup() {
/**
* Add support for the <title> tags.
* @since WordPress 4.1
@talentedaamer
talentedaamer / gist:9aeb1fc2f738bcb68f32
Last active November 25, 2015 08:06
Generate Unlimited Sidebars/Widget Areas using a single array();
<?php
/**
* theme widgets and widget areas
*/
add_action ( 'widgets_init', 'oopthemes_register_sidebar' );
function oopthemes_register_sidebar( $sidebars = array() ) {
foreach ( $sidebars as $name ) {
/**
* sidebar name, make the words uppercase
* @var string : each name of the sidebar in the array
@talentedaamer
talentedaamer / gist:72f5c4ed64912fa7aaf4
Created November 25, 2015 08:06
Generate Unlimited Sidebars using this array()
<?php
/**
* list of sidebars to be generated
* @var array : array of sidebars
*/
$sidebars = array(
'footer one sidebar',
'footer two sidebar',
'footer three sidebar',
'footer four sidebar',
@talentedaamer
talentedaamer / gist:68bccfe45eae395cd9c9
Created November 25, 2015 08:31
Register widget areas or sidebars in WordPress using register_sidebar() function
<?php
/**
* widgets_init action hook.
* used to register, widgets or widget areas in a theme.
*/
add_action( 'widgets_init', 'oopthemes_widgets_init' );
function oopthemes_widgets_init() {
register_sidebar( array(
'name' => __( 'Primary Sidebar', 'theme-slug' ),
'id' => 'sidebar-primary',
@talentedaamer
talentedaamer / gist:a623f5e09a21ce9f7af8
Last active November 26, 2015 04:56
Registering Properties Custom Post type with key "properties" and custom taxonomy with key "property-category"
<?php
/**
* Properties Post Type General Class
* @author Aamer
*
*/
class properties_cpt {
function properties_cpt() {
add_action( 'init', array( $this, 'create_property_cpt' ) );
@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: {
@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()));
<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 / 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
@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 );