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
// show post thumbnails in feeds | |
function fb_post_thumbnail_2_feeds( $content ) { | |
if ( has_post_thumbnail( get_the_ID() ) ) | |
$content = '<div>' . get_the_post_thumbnail( get_the_ID() ) . '</div>' . $content; | |
return $content; | |
} | |
add_filter( 'the_excerpt_rss', 'fb_post_thumbnail_2_feeds' ); | |
add_filter( 'the_content_feed', 'fb_post_thumbnail_2_feeds' ); |
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 | |
/* | |
* Example of how to use AJAX with WordPress to post and process Javascript arrays of objects. | |
* Drop this in your WordPress theme's functions.php file and it will display the array of objects on page load in the admin | |
* REF: http://lists.automattic.com/pipermail/wp-hackers/2011-September/040834.html | |
* By: Mike Schinkel - http://about.me/mikeschinkel | |
*/ | |
add_action( 'admin_init', 'mytheme_admin_init' ); | |
function mytheme_admin_init() { | |
wp_enqueue_script('jquery'); |
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: Mobile First Responsive Images | |
Description: Serve up smaller images to smaller screens. | |
Version: 0.1.1 | |
Author: Matt Wiebe | |
Author URI: http://somadesign.ca/ | |
*/ | |
/** |
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 | |
/** | |
* Widget | |
* @author | |
* @package | |
*/ | |
// TODO: change 'Fb_Wp_Widget_Basis' to the name of your actual plugin | |
class Fb_Wp_Widget_Basis extends WP_Widget { | |
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
/** | |
* A helper class for registering and handling a custom rewrite tag for a custom taxonomy. | |
* | |
* @version 1.0.0 | |
*/ | |
class Add_Taxonomy_To_Post_Permalinks { | |
/** | |
* Stores the taxonomy slug that this class will be handling. Don't edit this. | |
* |
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
-- generic email addresses and new passwords for users | |
UPDATE wp_users | |
SET user_email = CONCAT(user_login, '@example.com'), | |
user_pass = MD5(CONCAT(RAND(), CAST(ID AS CHAR), user_login)); | |
-- generic email addresses for commentors | |
UPDATE wp_comments | |
SET comment_author_email = CONCAT(CAST(comment_ID AS CHAR), '@example.com'); |
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: FB Widget Tutorial | |
Plugin URI: | |
Description: How to create WordPress Widgets. | |
Version: 13/03/2013 | |
Author: Frank Bültge | |
Author URI: http://bueltge.de/ | |
License: GPLv3 | |
*/ |
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: Reminder Emails | |
Plugin URI: http://www.christopherguitar.net/ | |
Description: Sends a reminder email if you haven't posted in seven days. | |
Version: n/a | |
Author: Christopher Davis | |
Author URI: http://www.christopherguitar.net | |
License: GPL2, Creative Commons | |
*/ |
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: AntiScript deamon | |
Plugin URI: https://github.com/franz-josef-kaiser | |
Description: Removes script-links to spam sites from your post content after your site got hacked. Please go to <a href="tools.php?page=script_deamon.php">Tools → Remove Hack</a>. Thank you. Proudly brought to you by <a href="http://example.com">Franz Josef Kaiser</a>. | |
Version: 0.1 | |
Author: Franz Josef Kaiser | |
Author URI: https://github.com/franz-josef-kaiser | |
License: GPL2 | |
WP-Version: Tested in 2.7.1, 2.9.2, 3.0 |
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
function extractWord($text, $position){ | |
$words = explode(' ', $text); | |
$characters = -1; | |
foreach($words as $word){ | |
$characters += strlen($word); | |
if($characters >= $position){ | |
return $word; | |
} | |
} | |
return ''; |