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: Per User Setting example | |
Plugin URI: http://example.com/ | |
Description: Allow choosing either English or Spanish in the admin area | |
Author: WROX | |
Author URI: http://wrox.com | |
*/ | |
// Return user's locale | |
function boj_adminlang_set_user_locale() { |
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 | |
// Fetches from an online radio a song title currently on air | |
function boj_myplugin_fetch_song_title_from_radio() { | |
// ... code to fetch data from the remote website | |
return $title; | |
} | |
// Get song title from database, using a 3 minute transient, and return it | |
function boj_myplugin_get_song_title() { | |
// Get transient value |
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 | |
// Register and define the settings | |
add_action('admin_init', 'boj_myplugin_admin_init'); | |
function boj_myplugin_admin_init(){ | |
//You still need to whitelist this setting, with register_setting() . | |
//Omitting this step would make WordPress ignore the setting when submitting the form. | |
register_setting( | |
'privacy', | |
'boj_myplugin_options', |
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: Settings API example | |
Plugin URI: http://example.com/ | |
Description: A complete and practical example of use of the Settings API | |
Author: WROX | |
Author URI: http://wrox.com | |
*/ | |
// Add a menu for our option page | |
add_action('admin_menu', 'boj_myplugin_add_page'); |
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: Unused Tags | |
Plugin URI: http://example.com/ | |
Description: Find unused tags and rename or delete them | |
Author: WROX | |
Author URI: http://wrox.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: Simple Debug | |
Plugin URI: http://example.com/ | |
Description: Append ?debug=1 to display debug info if you are an admin | |
Author: WROX | |
Author URI: http://wrox.com | |
*/ | |
add_action( 'init', 'boj_debug_check' ); |
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
<table class="widefat"> | |
<thead> | |
<tr> | |
<th>Name </th> | |
<th>Favorite Holiday </th> | |
</tr> | |
</thead> | |
<tfoot> | |
<tr> | |
<th>Name </th> |
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
<div class="wrap"> | |
<?php screen_icon( 'plugins' ); ?> | |
<h2>My Plugin </h2> | |
<form method="POST" action=""> | |
<table class="form-table"> | |
<tr valign="top"> | |
<th scope="row"> | |
<label for="fname">First Name </label> | |
</th> | |
<td> |
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: Meta Box Example Plugin | |
Plugin URI: http://example.com/wordpress-plugins/my-plugin | |
Description: A plugin to create meta boxes in WordPress | |
Version: 1.0 | |
Author: Brad Williams | |
Author URI: http://wrox.com | |
License: GPLv2 | |
*/ |
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: RSS Dashboard Widget Example Plugin | |
Plugin URI: http://example.com/wordpress-plugins/my-plugin | |
Description: A plugin to create dashboard widgets in WordPress | |
Version: 1.0 | |
Author: Brad Williams | |
Author URI: http://wrox.com | |
License: GPLv2 | |
*/ |