Skip to content

Instantly share code, notes, and snippets.

View rupert-ong's full-sized avatar

Rupert Ong rupert-ong

  • Toronto, Ontario
View GitHub Profile
@rupert-ong
rupert-ong / single.php
Created August 14, 2013 17:50
Wordpress: Post Time Snippet
<time datetime="<?php the_time('Y-m-d'); echo('T'); the_time('h:i:s'); ?>"><?php the_time('F j, Y') ?></time>
@rupert-ong
rupert-ong / functions.php
Last active December 20, 2015 23:09
Wordpress: Remove auto paragraphs from shortcode content
/**
* Don't auto-p wrap shortcodes that stand alone
*
* Ensures that shortcodes are not wrapped in <<p>>...<</p>>.
*
* @since 2.9.0
*
* @param string $pee The content.
* @return string The filtered content.
*/
@rupert-ong
rupert-ong / functions.php
Last active December 17, 2015 18:59
Wordpress: Remove Unwanted BR and P Tags around Shortcodes
// Place in functions.php
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 12);
// Place in your shortcode (in functions.php)
$content = wpautop(trim($content))
@rupert-ong
rupert-ong / Sass: Ultimate Media Query Mixin (Alwaystwisted.com)
Created April 25, 2013 13:51
Sass: Ultimate Media Query Mixin (Alwaystwisted.com)
@mixin mq($point, $IE9: false, $query1: min, $query2: width) {
@if $IE9 == true{
.lt-ie9 & {
@content;
}
@media screen and (#{$query1}-#{$query2}: $point / $base-font-size +em) {
@content;
}
}
@rupert-ong
rupert-ong / Wordpress - Sass Move style.css to parent directory (config.rb)
Created April 25, 2013 12:52
Wordpress: Sass - Move style.css to parent directory (config.rb)
# Move style.css to parent (root) directory of theme
require 'fileutils'
on_stylesheet_saved do |file|
if File.exists?(file) && File.basename(file) == "style.css"
puts "Moving: #{file}"
FileUtils.mv(file, File.dirname(file) + "/../" + File.basename(file))
end
end
@rupert-ong
rupert-ong / header.php
Created November 19, 2012 15:39
Wordpress: Navigation Menu Embed
<?php
if(function_exists('wp_nav_menu')):
wp_nav_menu(
array(
'menu' =>'primary_nav',
'container'=>'',
'depth' => 2,
'menu_id' => '' )
);
else:
@rupert-ong
rupert-ong / style.scss
Created November 19, 2012 15:01
Wordpress: Stylesheet Markup
/*
Theme Name:
Theme URI:
Author:
Author URI:
Description:
Version: 1.0
License: GNU General Public License
License URI: licensep
Tags:
@rupert-ong
rupert-ong / header.php
Created November 19, 2012 14:57
Wordpress: Page Indexing
<?php if ( (is_home() && (!$paged || $paged ==1)) || is_page() || is_single() || is_category()) :?>
<meta name="googlebot" content="index,archive,follow,noodp" />
<meta name="robots" content="all,index,follow" />
<meta name="msnbot" content="all,index,follow" />
<?php else : ?>
<meta name="googlebot" content="noindex,noarchive,follow,noodp" />
<meta name="robots" content="noindex,follow" />
<meta name="msnbot" content="noindex,follow" />
<?php endif; ?>
@rupert-ong
rupert-ong / header.php
Created November 19, 2012 14:47
Wordpress: Title Section
<?php if (function_exists('is_tag') && is_tag()) {
single_tag_title('Tag Archive for &quot;');
echo '&quot; - ';
} elseif (is_archive()) {
wp_title('');
echo ' Archive - ';
} elseif (is_search()) {
echo 'Search for &quot;'.wp_specialchars($s).'&quot; - ';
} elseif (!(is_404()) && (is_single()) || (is_page())) {
wp_title('');
@rupert-ong
rupert-ong / ajaxify-html5.js
Created September 25, 2012 14:03 — forked from balupton/README.md
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
// https://gist.github.com/854622
(function(window,undefined){
// Prepare our Variables
var
History = window.History,
$ = window.jQuery,
document = window.document;
// Check to see if History.js is enabled for our Browser