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 | |
/* | |
Plugin Name: Sample Plugin | |
Plugin URI: http://www.scottbressler.com/blog/plugins/ | |
Description: Sample plugin to demonstrate the basics of WordPress actions and filters, as well as storing plugin settings. This plugin adds content to the end of posts. This can be achieved when publishing the post or each time the post is displayed, as specified by the plugin's settings. The text appended is also specified in the settings. | |
Version: 1.1 | |
Author: Scott Bressler | |
Author URI: http://www.scottbressler.com/blog/ | |
License: GPL2 | |
*/ |
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 | |
/* | |
Plugin Name: Add to end of posts | |
Plugin URI: http://www.scottbressler.com/blog/plugins/ | |
Description: Sample plugin to add content to the end of posts using some simple WordPress hooks (filters and actions). This can be achieved when displaying the post or when publishing the post. Modify the class's constant "append_string" to change what is appended to posts. Modify "append_on_publish" to toggle whether text should be appended when publishing a post or when displaying the post. | |
Author: Scott Bressler | |
Version: 1.0 | |
Author URI: http://www.scottbressler.com/blog/ | |
*/ |
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 | |
/** | |
* Add Open Graph metadata to Post pages, including og:site_name, og:title, and og:image, if one exists. | |
*/ | |
function add_opengraph_meta() { | |
if ( !is_single() ) // Only add this metadata to Post pages | |
return; | |
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
<?php | |
$disallowed_roles = array( 'copy-editor', | |
'editor', | |
'contributor' ); | |
function is_user_disallowed() { | |
global $disallowed_roles; | |
foreach( $disallowed_roles as $disallowed_role) { | |
if ( current_user_can( $disallowed_role ) ) { |