Skip to content

Instantly share code, notes, and snippets.

View markwearing's full-sized avatar

Mark Wearing markwearing

  • One
  • Oxford, England
View GitHub Profile
@markwearing
markwearing / external-links.js
Created May 2, 2012 12:53
Open all external links in a new tab/window
@markwearing
markwearing / more-columns-wp-admin.php
Created May 2, 2012 13:27
Wordpress functions.php addition: Columns to display custom fields
/**
* This will add an additional columns called 'Students, Background, Outcome'to the custom post type of 'casestudies'.
* These new columns display the specified custom fields of a post.
*/
add_action("manage_posts_custom_column", "casestudies_custom_columns");
add_filter("manage_edit-casestudies_columns", "setup_casestudies_admin_columns");
function setup_casestudies_admin_columns($columns)
{
@markwearing
markwearing / ios-hovers.js
Created May 2, 2012 13:31
jQuery fix for old iOS's hover effects
// Wait until the DOM is fully loaded before executing the jQuery
$(document).ready(function($) {
// A little fix for the old ios's out there
// swap out #menu-main-navigation for your own id
$("#menu-main-navigation").on("a", "touchstart touchend", function (e) {
window.location = $(this).attr("href");s
});
});
@markwearing
markwearing / server-config.php
Created May 2, 2012 13:39
Display a servers configuration only from your ip address.
<?php
if ($_SERVER[‘REMOTE_ADDR’] == “28.57.742.18”):
phpinfo (); die();
endif; ?>
@markwearing
markwearing / oneltd_get_breadcrumbs
Created October 16, 2012 15:25
A breadcrumb function for the Wordpress boilerplate theme.
if ( ! function_exists( 'oneltd_get_breadcrumbs' ) ):
/*
* AO: Breadcrumbs function to echo out crumbs in LI's (With #breadcrumbs containing UL).
*
*/
function oneltd_get_breadcrumbs()
{
global $post;
$ancestors = get_post_ancestors( $post );
@markwearing
markwearing / oneltd_comment
Created October 16, 2012 15:49
Template for comments and pingbacks.
if ( ! function_exists( 'oneltd_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since oneltd 1.0
*/
function oneltd_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;