Skip to content

Instantly share code, notes, and snippets.

@bradvin
bradvin / jQuery.loadScript
Created April 5, 2012 19:03
conditional load script helper function with jQuery
jQuery.loadScript = function (url, arg1, arg2) {
var cache = false, callback = null;
//arg1 and arg2 can be interchangable as either the callback function or the cache bool
if ($.isFunction(arg1)){
callback = arg1;
cache = arg2 || cache;
} else {
cache = arg1 || cache;
callback = arg2 || callback;
}
@bradvin
bradvin / get_current_post_type.php
Created March 5, 2012 18:48 — forked from mjangda/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?php
/**
* gets the current post type in the WordPress Admin
*/
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type )
return $post->post_type;