Skip to content

Instantly share code, notes, and snippets.

View nikcree's full-sized avatar

Nik Cree nikcree

View GitHub Profile
@nikcree
nikcree / register-post-type.php
Created September 16, 2013 21:35 — forked from justintadlock/register-post-type.php
Add Custom Post Type to WordPress
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public
@nikcree
nikcree / 0_reuse_code.js
Created March 6, 2014 00:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
add_filter( 'genesis_attr_content', 'custom_attributes_content' );
/**
* Add the class needed for FacetWP to main element.
*
* Context: Posts page, all Archives and Search results page.
*
* @author Sridhar Katakam
* @link http://sridharkatakam.com/facetwp-genesis/
*/
function custom_attributes_content( $attributes ) {
@nikcree
nikcree / Clickable Phone Number
Last active August 29, 2015 14:23
Clickable Phone Number Example
<a title="Click To Call (07) 3103 3642" href="tel:+6131033642">(07) 3103 3642</a>
@nikcree
nikcree / Clickable Image Phone Number
Created June 30, 2015 03:51
Clickable Image Phone Number
<a title="Click to call" href="tel:+61234567891"><img src="http://www.domain.tld/image-file.png" alt="Clickable Phone Number Example" width="1000" height="238" /></a
@nikcree
nikcree / ajax-search.js
Last active December 14, 2015 20:59
Tool Tip Search in Primary Nav Location
// NB search for domain.com in this file and change it to your live domain.
jQuery(function($)
{
"use strict";
$(document).ready(function()
{
<?php
/*
* Google Phone Tracking For Google Adwords In A Genesis Child Theme.
*
* Step 1.
* Add this snippet into the Functions File, then ...
*
* Step 2.
* Replace all instance of the phone number (07) 1234 5678 ans =671712345678
# BEGIN Force HTTPS - Place after WordPress Permalink block
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
# END Force HTTPS
# BEGIN HSTS Support
# To ensure all urls are redirected to SSL
Header add Strict-Transport-Security: "max-age=15768000"
# END HSTS Support
# BEGIN Add Secure and httpOnly Flags to Every Set-Cookie Response in Apache httpd
Header always edit Set-Cookie (.*) "$1; HTTPOnly"
Header always edit Set-Cookie (.*) "$1; Secure"
# END Add Secure and httpOnly Flags to Every Set-Cookie Response in Apache httpd
# BEGIN SSL Rewrite
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]