Skip to content

Instantly share code, notes, and snippets.

View loorlab's full-sized avatar
💻
💥👩‍🚀👨‍🚀💥

LOOR Lab loorlab

💻
💥👩‍🚀👨‍🚀💥
View GitHub Profile
@chrisguitarguy
chrisguitarguy / kill-trackbacks.php
Created October 24, 2011 16:25
Kill all WordPress pingback/trackback functionality
<?php
/*
Plugin Name: Kill Trackbacks
Plugin URI: http://pmg.co/category/wordpress
Description: Kill all trackbacks on WordPress
Version: 1.0
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

@ninetwentyfour
ninetwentyfour / example1.php
Created August 28, 2011 16:39
Use WordPress’ is_page() To Display Custom Content - blogpost
<?php
if ( is_page('about')) {
echo '<div id="secondnav">This is the super cool secondary navigation.</div>';
}
?>
@salsalabs
salsalabs / change_recaptch_prompt.html
Last active January 11, 2016 02:36
Script to change the prompt for a reCaptcha object.
<script type="text/javascript">
// @see https://salsasupport.zendesk.com/entries/61500924
window.onload = function(){
var e = document.getElementById("recaptcha_response_field");
if (e != null) {
e.setAttribute("placeholder","Type what you see");
}
}
</script>
@saas786
saas786 / wp-js-loader.php
Created December 9, 2012 08:45
Wordpress and javascript loaders (dependency, asynchronous etc)
References:
http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress
http://headjs.com/
https://github.com/headjs/headjs
http://wordpress.org/extend/plugins/headjs-loader/
http://yepnopejs.com/
https://github.com/SlexAxton/yepnope.js
http://wordpress.stackexchange.com/questions/14895/asynchronous-javascript-loaders
@nathanhornby
nathanhornby / .htaccess
Created February 25, 2015 10:51
Browser caching
<IfModule mod_mime.c>
AddType text/css .css
AddType text/x-component .htc
AddType application/x-javascript .js
AddType application/javascript .js2
AddType text/javascript .js3
AddType text/x-js .js4
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
@Thielo
Thielo / categories.php
Created June 26, 2013 10:18
Quick Snippet to display Wordpress Categories.
<?php
$getCategoriesArgs = array('orderby' => 'name','parent' => 0);
$getCategories = get_categories($getCategoriesArgs);
if(count($getCategories) > 0){
echo '<ul>';
foreach ( $getCategories as $category ) {
echo '<li><a href="'.get_category_link($category->term_id).'">'.$category->name.'</a></li>';
}
echo '</ul>';
}
@eugenoprea
eugenoprea / functions.php
Last active May 17, 2016 15:23
How to Customize the Genesis Footer
/** Customize the entire footer */
remove_action('genesis_footer', 'genesis_do_footer');
add_action('genesis_footer', 'eo_custom_footer');
function eo_custom_footer()
{
echo '<p>';
echo 'Copyright &copy; ';
echo '2011 - ';
echo date('Y');
echo ' &middot; <a href="http://www.eugenoprea.com/" title="Eugen Oprea">Eugen Oprea</a> &middot; All rights reserved';
@baczoni
baczoni / gist:2479987
Created April 24, 2012 14:10
Wordpress: Page specific css and javascript
//Page specific css and/or javascript -- Add to header.php
if (is_page_template('page-archives.php')) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/ archives.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/ js/archives.js"></script>
<?php }