Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Ad settings!
- Plugin URI: http://www.script-install.com/
- Description: Custom ad settings
- Version: 0.1
- Author: Viruthagiri Thirumavalavan
- Author URI: http://www.script-install.com/
- */
- // Ad 1
- function ads1() {
- $options = get_option('ad_options');
- echo $options['ads1'];
- }
- // Ad 2
- function ads2() {
- $options = get_option('ad_options');
- echo $options['ads2'];
- }
- // options page
- function ad_options() {
- $options = $newoptions = get_option('ad_options');
- // if submitted, process results
- if ( $_POST["adstuff_submit"] ) {
- $newoptions['ads1'] = stripslashes($_POST["ads1"]);
- $newoptions['ads2'] = stripslashes($_POST["ads2"]);
- }
- // any changes? save!
- if ( $options != $newoptions ) {
- $options = $newoptions;
- update_option('ad_options', $options);
- }
- // options form
- echo '<form method="post">';
- echo "<div class=\"wrap\"><h2>Ad options</h2>";
- echo '<table class="form-table">';
- // Ad 1
- echo '<tr valign="top"><th scope="row">200 x 200 Ad code</th>';
- echo '<td><textarea size="100" style="width: 98%; font-size: 12px;" class="code" name="ads1" id="ads1" cols="60" rows="2">'.$options['ads1'].'</textarea></td></tr>';
- // Ad 1
- echo '<tr valign="top"><th scope="row">300 x 250 Ad code</th>';
- echo '<td><textarea size="100" style="width: 98%; font-size: 12px;" class="code" name="ads2" id="ads2" cols="60" rows="2">'.$options['ads2'].'</textarea></td></tr>';
- // close stuff
- echo '<input type="hidden" name="adstuff_submit" value="true"></input>';
- echo '</table>';
- echo '<p class="submit"><input type="submit" value="Update Options »"></input></p>';
- echo "</div>";
- echo '</form>';
- }
- function adstuff_add_pages() {
- add_submenu_page('settings.php', 'Ad settings', 'Ad settings', 10, __FILE__, 'ad_options');
- }
- add_action('network_admin_menu', 'adstuff_add_pages');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement