Skip to content

Instantly share code, notes, and snippets.

View trepmal's full-sized avatar
🍪

Kailey Lampert trepmal

🍪
View GitHub Profile
@trepmal
trepmal / gist:9691061
Last active August 29, 2015 13:57
Sample code - add menu item with pre-added classes (possibly useful if paired with custom walker that checks for a class and changes output accordingly)
<?php
/*
* Plugin Name: Linkless Menu Items
* Plugin URI:
* Description:
* Version:
* Author: Kailey Lampert
* Author URI:
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
<?php
// This is probably a bad idea.
class LocalizeTest {
function __construct( $instance ) {
$this->instance = $instance;
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
}
@trepmal
trepmal / permalink-col.php
Last active August 29, 2015 14:00
custom column with permalinks
<?php
// script on registration page only
// limited testing
// can go in path/to/wp/wp-content/mu-plugins/
add_action( 'login_enqueue_scripts', function() {
if ( isset( $_REQUEST['action'] ) && 'register' == $_REQUEST['action'] ) {

Keybase proof

I hereby claim:

  • I am trepmal on github.
  • I am trepmal (https://keybase.io/trepmal) on keybase.
  • I have a public key whose fingerprint is 1B8A 38B8 E00E 1760 2FD2 3C38 6992 928D 1F27 C8F7

To claim this, I am signing this object:

#!/bin/bash
echo '==Archiving=='
echo 'Which site (slug as used in nginx conf)?'
read site
if [[ -z "$site" ]]; then
exit;
fi
@trepmal
trepmal / variable-hooks.txt
Created June 29, 2014 20:52
variable hooks in wordpress
add_option_{$option} add_site_option_{$option} add_{$meta_type}_meta added_{$meta_type}_meta admin_head-{$hook_suffix} admin_head-{$hook_suffix} admin_head_{$content_func} admin_print_scripts-{$hook_suffix} admin_print_scripts-{$hook_suffix} admin_print_styles-{$hook_suffix} admin_print_styles-{$hook_suffix} after-{$taxonomy}-table after_plugin_row_{$plugin_file} after_theme_row_{$stylesheet} comment_{$new_status}_{$comment->comment_type} comment_{$old_status}_to_{$new_status} create_{$taxonomy} created_{$taxonomy} delete_{$taxonomy} delete_option_{$option} delete_site_option_{$option} delete_{$meta_type}_meta delete_{$meta_type}meta deleted_{$meta_type}_meta deleted_{$meta_type}meta edit_{$taxonomy} edited_{$taxonomy} get_template_part_{$slug} in_plugin_update_message-{$file} in_theme_update_message-{$theme_key} install_plugins_{$tab} install_plugins_pre_{$tab} install_themes_pre_{$tab} install_themes_{$tab} manage_{$post->post_type}_posts_custom_column media_upload_{$tab} media_upload_{$type} save_post_{$po
@trepmal
trepmal / comment-generate-cli.php
Created July 3, 2014 18:15
Can either pop this into a plugin and activate it to make the command available. Or install as a package via these instructions: https://github.com/wp-cli/wp-cli/wiki/Community-Packages
<?php
if ( !defined( 'WP_CLI' ) ) return;
/**
* Comment Generate
*/
class Comment_Generate extends WP_CLI_Command {
/**
@trepmal
trepmal / wp-cli-regen
Created July 16, 2014 21:59
wp media regenerate: only featured images of sticky posts
# regen only featured images of sticky posts
wp media regenerate $(wp eval 'foreach( wp_parse_id_list( get_option("sticky_posts") ) as $id ) { echo get_post_thumbnail_id($id). " "; }')
#!/bin/sh
# save this file as something like bulkimport.sh
# pass directory as first arg
# e.g.
#> ./bulkimport.sh xmls-in-here/
for wxr in `find $1`;
do