Skip to content

Instantly share code, notes, and snippets.

View kovshenin's full-sized avatar

Konstantin Kovshenin kovshenin

View GitHub Profile
<?php
/**
* Plugin Name: Hide Akismet
*/
add_filter( 'all_plugins', function( $plugins ) {
unset( $plugins['akismet/akismet.php'] );
return $plugins;
});
<?php
add_filter( 'locale', function( $locale ) {
if ( empty( $_COOKIE['lang'] ) )
return $locale;
elseif ( $_COOKIE['lang'] == 'ru' )
$locale = 'ru_RU';
elseif ( $_COOKIE['lang'] == 'ja' )
$locale = 'ja_JA';
@kovshenin
kovshenin / Foo.bar
Last active December 17, 2015 02:08
Exploring the themes directory.
# Find themes using Open Graph tags.
ack '"og:[^"]+"' | perl -n -e '/^([^\/]+)/ && print "$1\n"' | uniq
# Find themes using the word "SEO" in their theme description
ack 'Description: .*\bSEO\b' | perl -n -e '/^([^\/]+)/ && print "$1\n"' | uniq
<?php
/**
* Plugin Name: My Plugin
*/
function my_admin_enqueue_scripts() {
wp_enqueue_script( 'jquery-ui-button' );
}
add_action( 'admin_enqueue_scripts', 'my_admin_enqueue_scripts' );
# A list of SEO optimized themes. Not!
$ ack 'Description: .*?\bSEO\b' | perl -n -e '/^([^\/]+)/ && print "$1\n"' | uniq
albizia
amdhas
amerifecta
angler
apricot
auroral-theme
bandana
# See: http://kovshenin.com/2013/dont-do_shortcode/
$ ack 'do_shortcode\(\s*['\''"]\['
8tracks-mix-feeds/8tracks-mix-feeds.php:74: <?php echo do_shortcode( '[mixes heading="Mixes I Dig" item_size="150" user="chateloinus" items="25" items_per_row="5" type="mix_feed"]' ); ?>
8tracks-mix-feeds/8tracks-mix-feeds.php:239: echo do_shortcode( '[mixes heading="' . ''
8tracks-shortcode/8tracks_shortcode.php:195: echo do_shortcode('[8tracks url="'.stripslashes($eighttracksurl).'" height="'.intval($eighttracksheight).'" width="'.intval($eighttrackswidth).'" flash="'.stripslashes($eighttracksflash).'" "]');
absolute-privacy/profile_page.php:9: echo do_shortcode( '[loginform]' );
abt-featured-heroes/abt-featured-heroes.php:152: echo do_shortcode( "[abt_slider_hero $att_str]" );
accordion-image-menu/accordion-image-menu.php:99: echo do_shortcode('[a_image_menu]');
accordion-image-menu/accordion-image-menu.php:882: <td align="left" scope="row"><?php _e('In your theme files using: <strong>&#60;&
<?php
function mlbtv_shortcode( $attr, $content = '' ) {
$attr = shortcode_atts( array(
'id' => null,
'width' => 400,
'height' => 224,
), $attr );
$attr = array_map( 'absint', $attr );
$url = add_query_arg( array(
#tix {
width: 99%;
}
.tix_tickets_table {
width: 100%;
border-spacing: 0;
border-collapse: separate;
}
<style type='text/css'>
#tix {
width: 99%;
}
.tix_tickets_table {
width: 100%;
border-spacing: 0;
border-collapse: separate;
}
@kovshenin
kovshenin / plugin.php
Created November 4, 2013 09:24
Allow SWF file uploads in WordPress 3.7
<?php
/**
* Plugin Name: Allow SWF uploads
* Description: This is insecure.
*/
add_filter( 'upload_mimes', 'my_upload_mimes' );
function my_upload_mimes( $mimes ) {
$mimes['swf'] = 'application/x-shockwave-flash';
return $mimes;
}