Support » Plugins » simple wordpress plugin to add actionable text after blog content – feedback?

  • hi all, i’ve written a SUPER simple plugin that appends text after the content if you’re viewing a blog post, and the text is editable via the admin system. i’ll post the code below, does this look right? represent any security risks? any help or suggestions or feedback would be appreciated as it’s my first plugin.

    Plugin Name: Now What
    Plugin URI:
    Description: Putting action-item text at the end of every post
    Version: 1.0
    Author: Paul Jarvis
    Author URI:
    Released under the GNU General Public License (GPL)
    	function hello_world_install() { add_option("now_what_pjrvs_data", 'Default', '', 'yes'); }
    register_deactivation_hook( __FILE__, 'now_what_pjrvs_remove' );
    	function hello_world_remove() { delete_option('now_what_pjrvs_data'); }
    if (is_admin()) {
    	add_action('admin_menu', 'now_what_pjrvs_admin_menu');
    	function now_what_pjrvs_admin_menu() {
    	add_options_page('Now What Options', 'Now What', 'administrator',
    	'now-what', 'now_what_html_page');
    } // end if
    function now_what_html_page() { ?>
    	<div class="wrap">
    		<h2>Now What Options</h2>
    		<p><em>Adding actionable items to the end of each post (like tweet this, share on facebook, subscribe to the RSS).</em></p>
    		<p>Enter Your "Now What" Text:</p>
    		<form method="post" action="options.php">
    			<?php wp_nonce_field('update-options'); ?>
    			<table class="form-table" cellpadding="20">
    				<tr valign="top">
    						<textarea name="now_what_pjrvs_data" type="text" id="now_what_pjrvs_data" rows="10" cols="80"><?php echo get_option('now_what_pjrvs_data'); ?></textarea>
    			<input type="hidden" name="action" value="update" />
    			<input type="hidden" name="page_options" value="now_what_pjrvs_data" />
    			<br />
    			<button type="submit" class="button-primary"><?php _e('Save Changes') ?></button>
    		<h3><br /><br />Sample Text to share your RSS link, RSS email subscription link (feedburner), twitter share widget and facebook share widget (copy and paste to the above field to use it - and make sure to change the feedburner URLs to your own URL):</h3>
    		<textarea rows="10" cols="80"><div class="now-what"><strong>thanks for reading my article!</strong><br />
    you can subscribe to my <a href="">rss feed</a> or <a href="">via email</a> so you never miss a new article. if you'd like to share what you just read, you can do it on <a href="javascript:void(0);" onclick="return fbs_click()">facebook</a> or on <a href="javascript:void(0);" onclick="return twitter_click()">twitter</a>.
    <script type="text/javascript">
    function fbs_click(){
    u=location.href;t=document.title;''+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
    function twitter_click(){
    u=location.href;t=document.title;''+encodeURIComponent(u)+'&text='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
    		<h3><br /><br />Here's what you've got currently:</h3>
    		<p><?php echo get_option('now_what_pjrvs_data'); ?></p>
    		<h3><br /><br />Learn More</h3>
    		<p><a href="">Read the</a> post that started this plugin.</p>
    <?php	}
    function now_what_pjrvs($content = '') {
    	$text = get_option('now_what_pjrvs_data');
    	if(is_single()) {
    		return $content . $text;
    	} else {
    		return $content;
Viewing 2 replies - 1 through 2 (of 2 total)
  • digitalrenewal


    have you been using this alot? looks like an awesome SIMPLE plugin and there are no others out there like it.

    I tried it and its working perfectly. any updates or tweaks?



    EXCELLENT name for the plugin by the way 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘simple wordpress plugin to add actionable text after blog content – feedback?’ is closed to new replies.