WordPress.org

Ready to get started?Download WordPress

Forums

add options to post-new.php (3 posts)

  1. mores
    Member
    Posted 6 years ago #

    Hi there,

    after successfully launching my first plugin, I am trying to make it more user-friendly by adding features that were requested.

    So, I thought the most elegant solution for EasyPermGals to most flexible would be to allow the user to activate/deactivate the function while writing the post or page.
    So, instead of my plugin adding stuff automatically to every post or page, and also to not force the user to use ]special codes[, I want to add a simple checkbox to the post-new.php and page-new.php files.

    How do I do that?

  2. snomead
    Member
    Posted 6 years ago #

    I've done something like this :

    add_action('admin_menu', 'myplugin_addOption');
    
    function myplugin_addOption()
    {
    	if( function_exists( 'add_meta_box' )) {
    	    add_meta_box( 'myPlugin_id','SMS Protect', 'myPlugin_addMetaBox','page','advanced');
    	    add_meta_box( 'myPlugin_id','SMS Protect', 'myPlugin_addMetaBox','post','advanced');
    	}
    }
    
    function myPlugin_addMetaBox(){
    	?>
    	<p>
    		<label class="selectit" for="comment_status">
    		<input id="myPlugin_status" type="checkbox" value="myPlugin" name="myPlugin_status"/>
    		Blablabla
    		</label>
    	</p>
    	<?php
    }

    It's such a raw code... but I'm sure you can go along with that :)

  3. mores
    Member
    Posted 6 years ago #

    thanks, snomead.
    Looks promising, I'll give it a try!

Topic Closed

This topic has been closed to new replies.

About this Topic