Want more features on Pastebin? Sign Up, it's FREE!

options.php

By: SRD75 on Dec 26th, 2012  |  syntax: PHP  |  size: 2.79 KB  |  views: 46  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * A unique identifier is defined to store the options in the database and reference them from the theme.
  4.  * By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
  5.  * If the identifier changes, it'll appear as if the options have been reset.
  6.  */
  7.  
  8. function optionsframework_option_name() {
  9.  
  10.         // This gets the theme name from the stylesheet
  11.         $themename = get_option( 'stylesheet' );
  12.         $themename = preg_replace("/\W/", "_", strtolower($themename) );
  13.  
  14.         $optionsframework_settings = get_option( 'optionsframework' );
  15.         $optionsframework_settings['id'] = $themename;
  16.         update_option( 'optionsframework', $optionsframework_settings );
  17. }
  18.  
  19. /**
  20.  * Defines an array of options that will be used to generate the settings page and be saved in the database.
  21.  * When creating the 'id' fields, make sure to use all lowercase and no spaces.
  22.  *
  23.  * If you are making your theme translatable, you should replace 'options_framework_theme'
  24.  * with the actual text domain for your theme.  Read more:
  25.  * http://codex.wordpress.org/Function_Reference/load_theme_textdomain
  26.  */
  27.  
  28. function optionsframework_options() {
  29.  
  30.         // Background Defaults
  31.         $background_defaults = array(
  32.                 'color' => '',
  33.                 'image' => '',
  34.                 'repeat' => 'repeat',
  35.                 'position' => 'top center',
  36.                 'attachment'=>'scroll' );
  37.  
  38.         // Typography Defaults
  39.         $typography_defaults = array(
  40.                 'size' => '15px',
  41.                 'face' => 'georgia',
  42.                 'style' => 'bold',
  43.                 'color' => '#bada55' );
  44.                
  45.         // Typography Options
  46.         $typography_options = array(
  47.                 'sizes' => array( '6','12','14','16','20' ),
  48.                 'faces' => array( 'Helvetica Neue' => 'Helvetica Neue','Arial' => 'Arial' ),
  49.                 'styles' => array( 'normal' => 'Normal','bold' => 'Bold' ),
  50.                 'color' => false
  51.         );     
  52.  
  53.         // If using image radio buttons, define a directory path
  54.         $imagepath =  get_template_directory_uri() . '/images/';
  55.  
  56.         $options = array();
  57.  
  58.         $options[] = array(
  59.                 'name' => __('Basic Settings', 'options_framework_theme'),
  60.                 'type' => 'heading');
  61.  
  62.         $options[] = array(
  63.                 'name' => __('Theme Colour', 'options_framework_theme'),
  64.                 'desc' => __('Select the base colour of the theme', 'options_framework_theme'),
  65.                 'id' => 'colour',
  66.                 'std' => 'green',
  67.                 'type' => 'radio',
  68.                 'options' => $test_array);
  69.        
  70.         $options[] = array(
  71.                 'name' => __('Logo', 'options_framework_theme'),
  72.                 'desc' => __('Upload your logo image.  Maximum height is 100 pixels.', 'options_framework_theme'),
  73.                 'id' => 'logo_uploader',
  74.                 'type' => 'upload');
  75.  
  76.         $options[] = array(
  77.                 'name' => "Banner Image",
  78.                 'desc' => "Select the image used under the heading.",
  79.                 'id' => "banner_image",
  80.                 'std' => "horse",
  81.                 'type' => "images",
  82.                 'options' => array(
  83.                         'horse' => $imagepath . 'banners\'1.jpg',
  84.                         'forrest' => $imagepath . 'banners\'2.jpg'
  85.         ));
  86.  
  87.         return $options;
  88. }
clone this paste RAW Paste Data