1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-05-15 01:32:11 +03:00

updating the docblocks and actually registering the demo scripts and styles

This commit is contained in:
Tom McFarlin 2014-05-03 15:27:01 -04:00
parent b3451b717f
commit 8cfee0e67a
4 changed files with 71 additions and 35 deletions

View file

@ -1,11 +1,15 @@
<?php <?php
/** /**
* Define a short description for what this class does. * Define a short description for what this class does (no period)
* *
* @since 1.0.0
* @package Plugin_Name * @package Plugin_Name
* @subpackage Plugin_Name/public * @subpackage Plugin_Name/public
* @author Your Name <email@example.com>
* @license GPL-2.0+
* @link http://example.com
* @copyright 2014 Your Name or Company Name
* @since 1.0.0
*/ */
/** /**
@ -13,10 +17,9 @@
* *
* Define a longer description for the purpose of this class. * Define a longer description for the purpose of this class.
* *
* @author Your Name <your@email.com> * @package Plugin_Name
* @license GPL-2.0+ * @subpackage Plugin_Name/public
* @link URL * @author Your Name <email@example.com>
* @copyright 2014 Your Name or Company Name
*/ */
class Plugin_Name_Public_Loader { class Plugin_Name_Public_Loader {
@ -26,9 +29,9 @@ class Plugin_Name_Public_Loader {
* Long description. * Long description.
* *
* @since 1.0.0 * @since 1.0.0
* @param type $plugin_name_public TODO * @param type $plugin_name_public A reference to the Plugin_Name_Public class that defines the functions for the hooks.
*/ */
public function run( $plugin_name_public ) { public function run( Plugin_Name_Public $plugin_name_public ) {
/** /**
* This function is used to define the various hooks that are used in the * This function is used to define the various hooks that are used in the
@ -37,12 +40,11 @@ class Plugin_Name_Public_Loader {
* *
* Each hook then corresponds to a public function defined within the Plugin_Name_Public * Each hook then corresponds to a public function defined within the Plugin_Name_Public
* class. * class.
*
* For example:
*
* add_filter( 'the_content', array( $plugin_name_public, 'display_the_content' ) );
*/ */
add_action( 'wp_enqueue_scripts', array( $plugin_name_public, 'enqueue_styles' ) );
add_action( 'wp_enqueue_scripts', array( $plugin_name_public, 'enqueue_scripts' ) );
} }
} }

View file

@ -1,10 +1,15 @@
<?php <?php
/** /**
* Define a short description for what this class does. * Define a short description for what this class does (no period)
* *
* @since x.x.x * @package Plugin_Name
* @package TODO * @subpackage Plugin_Name/public
* @author Your Name <email@example.com>
* @license GPL-2.0+
* @link http://example.com
* @copyright 2014 Your Name or Company Name
* @since 1.0.0
*/ */
/** /**
@ -12,11 +17,9 @@
* *
* Define a longer description for the purpose of this class. * Define a longer description for the purpose of this class.
* *
* @package TODO * @package Plugin_Name
* @author Your Name <your@email.com> * @subpackage Plugin_Name/public
* @license GPL-2.0+ * @author Your Name <email@example.com>
* @link URL
* @copyright 2014 Your Name or Company Name
*/ */
class Plugin_Name_Public { class Plugin_Name_Public {
@ -26,11 +29,8 @@ class Plugin_Name_Public {
* Long description. * Long description.
* *
* @since 1.0.0 * @since 1.0.0
* @link URL
* @param string $content The content for the post type that's being filtered.
* @return string The modified version of the post content.
*/ */
public function display_the_content( $content ) { public function enqueue_styles() {
/** /**
* This function is provided for demonstration purposes only. * This function is provided for demonstration purposes only.
@ -44,7 +44,32 @@ class Plugin_Name_Public {
* class. * class.
*/ */
return $content; wp_enqueue_style( 'plugin-name-public', plugin_dir_url( __FILE__ ) . 'css/plugin-name-public.css', array(), PLUGIN_NAME_VER, 'all' );
}
/**
* Short description. (use period)
*
* Long description.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Plugin_Name_Public_Loader as all of the hooks are defined
* in that particular class.
*
* The Plugin_Name_Public_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( 'plugin-name-public', plugin_dir_url( __FILE__ ) . 'js/plugin-name-public.js', array( 'jquery' ), PLUGIN_NAME_VER, FALSE );
} }

View file

@ -13,14 +13,20 @@
* ready: * ready:
* *
* $(function() { * $(function() {
*
* }); * });
* *
* Or when the window is completely ready: * Or when the window is completely ready:
* *
* $( window ).load(function() { * $( window ).load(function() {
*
* }); * });
* *
* ...and so on. * ...and so on.
*
* Remember that ideally, we should not attach anymore than a single DOM-ready or window-load handler
* for any particular page. Though other scripts in WordPress core, other plugins, and other themes may
* be doing this, we should try to minimize doing that in our own work.
*/ */
})( jQuery ); })( jQuery );

View file

@ -1,10 +1,15 @@
<?php <?php
/** /**
* Define a short description for what this file does. * Define a short description for what this file does (no period)
* *
* @since x.x.x * @package Plugin_Name
* @package TODO * @subpackage Plugin_Name/public/partials
* @author Your Name <email@example.com>
* @license GPL-2.0+
* @link http://example.com
* @copyright 2014 Your Name or Company Name
* @since 1.0.0
*/ */
/** /**
@ -12,11 +17,9 @@
* *
* Define a longer description for the purpose of this file. * Define a longer description for the purpose of this file.
* *
* @package TODO * @package Plugin_Name
* @author Your Name <your@email.com> * @subpackage Plugin_Name/public/partials
* @license GPL-2.0+ * @author Your Name <email@example.com>
* @link URL
* @copyright 2014 Your Name or Company Name
*/ */
?> ?>