This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_posts AS p | |
JOIN wp_term_relationships AS tr ON tr.object_id = p.id | |
JOIN wp_term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id | |
JOIN wp_terms AS t ON tt.term_id = t.term_id | |
SET p.post_date = REPLACE(p.post_date, YEAR(p.post_date), 2012) | |
WHERE t.slug = 'my-category-slug' AND tt.taxonomy = 'category'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'classes/household.php'; | |
require 'classes/birthday.class.php'; | |
require 'classes/birthday.boy.class.php'; | |
require 'classes/friend.php'; | |
$K = new Birthday_Boy(); | |
foreach ( $K->check_phone()->check_im()->check_social() as $greetings ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WP_Plugin class test | |
Description: Tosting things out, again. | |
Author: Konstantin Kovshenin | |
Version: 1.0 | |
Author URI: http://kovshenin.com | |
*/ | |
class WP_Plugin { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Image shortcode callback | |
* | |
* Enables the [kovshenin_image] shortcode, pseudo-TimThumb but creates resized and cropped image files | |
* from existing media library entries. Usage: | |
* [kovshenin_image src="http://example.org/wp-content/uploads/2012/03/image.png" width="100" height="100"] | |
* | |
* @uses image_make_intermediate_size | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Text Field | |
* | |
* A simple text field callback to use with the Settings API. Don't forget to pass in | |
* the arguments array. Here's an example call to add_settings_field() : | |
* | |
* add_settings_field( 'my_option', __( 'My Option' ), 'foo_field_text', 'theme_options', 'general', array( | |
* 'name' => 'my_theme_options[my_option]', | |
* 'value' => $options['my_option'], // assuming $options is declared |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Foo Bar | |
*/ | |
add_action( 'save_post', 'my_save_post' ); | |
function my_save_post( $post_id ) { | |
if ( wp_is_post_revision( $post_id ) ) | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'my_remove_post_dates' ); | |
function my_remove_post_dates() { | |
if ( ! in_array( get_current_blog_id(), array( 21, 22 ) ) ) | |
return; | |
add_filter( 'the_date', '__return_null', 99 ); | |
add_filter( 'the_time', '__return_null', 99 ); | |
add_filter( 'the_modified_date', '__return_null', 99 ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'my_pre_get_posts' ); | |
function my_pre_get_posts( $query ) { | |
if ( ! $query->is_main_query() ) | |
return; | |
$woo_search = woo_dynamic_search_header(); | |
if ( isset( $woo_search['query_args'] ) ) | |
foreach ( $woo_search['query_args'] as $key => $value ) | |
$query->set( $key, $value ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Oh noes, not another SEO plugin! | |
* License: GPLv3 http://www.gnu.org/copyleft/gpl.html | |
*/ | |
add_filter( 'wp_title', function( $title ) { | |
if ( is_singular() ) $title .= ' — ' . get_bloginfo( 'name' ); | |
if ( is_archive() ) $title = sprintf( ' Archives: %s — %s', $title, get_bloginfo( 'name' ) ); | |
if ( is_home() ) $title = sprintf( '%s — %s', get_bloginfo( 'name' ), get_bloginfo( 'description' ) ); | |
if ( is_search() ) $title = sprintf( 'Searching for: %s — %s', get_search_query( true ), get_bloginfo( 'description' ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Foo | |
*/ | |
add_image_size( 'my-rss-thumbnail', 292, 136, true ); | |
add_action( 'rss2_item', 'my_rss2_item' ); | |
function my_rss2_item() { | |
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'my-rss-thumbnail' ); | |
if ( ! $thumbnail ) return; |