Skip to content

Instantly share code, notes, and snippets.

@hermpheus
hermpheus / gist:2202892
Created March 26, 2012 04:13
JavaScript: Detect Browser Support for HTML5 Attribute
function elementSupportsAttribute(element,attribute) {
var test = document.createElement(element);
if (attribute in test) { return true; }
else { return false; }
}
@hermpheus
hermpheus / gist:2176425
Created March 23, 2012 23:42
WordPress: Create Admin Account via FTP
function add_admin_acct(){
$login = 'myacct1';
$passw = 'mypass1';
$email = '[email protected]';
if ( !username_exists( $login ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $login, $passw, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
@hermpheus
hermpheus / is_blog.php
Created March 17, 2012 18:47 — forked from wesbos/is_blog.php
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@hermpheus
hermpheus / gist:2055091
Created March 17, 2012 04:54
WordPress: Theme Header
/*
Theme Name: Twenty Ten
Theme URI: http://wordpress.org/
Description: The 2010 default theme for WordPress.
Author: wordpressdotorg
Author URI: http://wordpress.org/
Version: 1.0
Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)
License:
@hermpheus
hermpheus / gist:2055084
Created March 17, 2012 04:53
WordPress: Plugin Header
<?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/