This file contains 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 | |
// initialize plugin | |
if ( function_exists( 'add_action' ) && function_exists( 'register_activation_hook' ) ) { | |
add_action( 'plugins_loaded', array( 'tabbed_plugin', 'get_object' ) ); | |
} | |
class tabbed_plugin | |
{ | |
// singleton class variable | |
static private $classobj = NULL; |
This file contains 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 | |
function change_welcome_mail_loginlink( $welcome_email, $user_id, $password, $meta ) { | |
$welcome_email = str_replace( 'LOGINLINK', 'http://www.mysite.com/my/custom/login/url', $welcome_email ); | |
return $welcome_email; | |
} | |
add_filter( 'update_welcome_user_email', 'change_welcome_mail_loginlink', 10, 4 ); |
This file contains 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 | |
$some_var = 'WordPress'; | |
$string = 'This is my text and ' . $some_var . ' is the best publishing System in the World'; |
This file contains 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
<input type="hidden" name="comments[1][content]" value="foo" /> | |
<input type="hidden" name="comments[2][content]" value="bar" /> |
This file contains 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 | |
class MyPlugin { | |
static function activation_hook() { | |
if ( ! version_compare( PHP_VERSION, '5.3.0', '>=' ) ) { | |
deactivate_plugins( __FILE__ ); | |
wp_die( wp_sprintf( '%1s: ' . __( 'Sorry, This plugin has taken a bold step in requiring PHP 5.3.0+. Your server is currently running PHP %2s, Please bug your host to upgrade to a recent version of PHP which is less bug-prone.', 'myplugin' ), __FILE__ , PHP_VERSION ) ); | |
} | |
} | |
} | |
register_activation_hook( __FILE__, array( 'MyPlugin', 'activation_hook' ) ); |
This file contains 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 | |
class content_parser { | |
public function __construct() { | |
// apply parser to all posts | |
add_filter( 'the_content', array( __CLASS__, 'parse' ) ); | |
} | |
public static function parse( $text ) { | |
global $post; |
This file contains 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
ericteubert: ~/Sites/wordpress-single | |
➜ ack widget_text | |
wp-admin/includes/schema.php | |
307: 'widget_text' => array(), | |
wp-content/plugins/ikonum/class/class.custom-field-template.php | |
101: add_filter('widget_text', 'do_shortcode'); | |
wp-includes/default-widgets.php | |
371: $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML')); |
This file contains 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 | |
function enable_edit_any_user_configuration () { | |
return true; | |
} | |
add_action( 'enable_edit_any_user_configuration', 'enable_edit_any_user_configuration' ); |
This file contains 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 | |
if ( $attachment->post_parent > 0 ) { | |
$link = get_permalink( $attachment->post_parent ); | |
} else { | |
$link = get_attachment_link( $attachment->ID ); | |
} | |
$img = wp_get_attachment_image( $attachment->ID ); | |
?> | |
<a href="<?php echo $link ?>"><?php echo $img ?></a> |
This file contains 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 | |
// Alternative 1 | |
function my_postbox_fun() { | |
# code... | |
} | |
postbox( 'My Awesome Postbox', 'my_postbox_fun' ); | |
// Alternative 2 | |
class my_example_class | |
{ |