Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2014
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 16.16 KB | None | 0 0
  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.  
  9. function optionsframework_option_name() {
  10.  
  11.         // This gets the theme name from the stylesheet
  12.         $themename = wp_get_theme();
  13.         $themename = preg_replace("/\W/", "_", strtolower($themename) );
  14.  
  15.         $optionsframework_settings = get_option( 'optionsframework' );
  16.         $optionsframework_settings['id'] = $themename;
  17.         update_option( 'optionsframework', $optionsframework_settings );
  18. }
  19.  
  20. /**
  21.  * Defines an array of options that will be used to generate the settings page and be saved in the database.
  22.  * When creating the 'id' fields, make sure to use all lowercase and no spaces.
  23.  *
  24.  */
  25.  
  26. function optionsframework_options() {
  27.  
  28.         // Layout options
  29.         $site_layout = array('pull-left' => __('Right Sidebar', 'dazzling'),'pull-right' => __('Left Sidebar', 'dazzling'));
  30.  
  31.        // Test data
  32.         $test_array = array(
  33.                 'one' => __('One', 'options_framework_theme'),
  34.                 'two' => __('Two', 'options_framework_theme'),
  35.                 'three' => __('Three', 'options_framework_theme'),
  36.                 'four' => __('Four', 'options_framework_theme'),
  37.                 'five' => __('Five', 'options_framework_theme')
  38.         );
  39.  
  40.         // Multicheck Array
  41.         $multicheck_array = array(
  42.                 'one' => __('French Toast', 'options_framework_theme'),
  43.                 'two' => __('Pancake', 'options_framework_theme'),
  44.                 'three' => __('Omelette', 'options_framework_theme'),
  45.                 'four' => __('Crepe', 'options_framework_theme'),
  46.                 'five' => __('Waffle', 'options_framework_theme')
  47.         );
  48.  
  49.         // Multicheck Defaults
  50.         $multicheck_defaults = array(
  51.                 'one' => '1',
  52.                 'five' => '1'
  53.         );
  54.  
  55.         // Typography Defaults
  56.         $typography_defaults = array(
  57.                 'size' => '14px',
  58.                 'face' => 'Helvetica Neue',
  59.                 'style' => 'normal',
  60.                 'color' => '#6B6B6B' );
  61.  
  62.         // Typography Options
  63.         $typography_options = array(
  64.                 'sizes' => array( '6','10','12','14','15','16','18','20','24','28','32','36','42','48' ),
  65.                 'faces' => array(
  66.                                                         'arial'     => 'Arial',
  67.                                                         'verdana'   => 'Verdana, Geneva',
  68.                                                         'trebuchet' => 'Trebuchet',
  69.                                                         'georgia'   => 'Georgia',
  70.                                                         'times'     => 'Times New Roman',
  71.                                                         'tahoma'    => 'Tahoma, Geneva',
  72.                                                         'palatino'  => 'Palatino',
  73.                                                         'helvetica' => 'Helvetica',
  74.                                                         'Helvetica Neue' => 'Helvetica Neue'
  75.                                                     ),
  76.                 'styles' => array( 'normal' => 'Normal','bold' => 'Bold' ),
  77.                 'color' => true
  78.         );
  79.  
  80.         // $radio = array('0' => __('No', 'dazzling'),'1' => __('Yes', 'dazzling'));
  81.  
  82.             // Pull all the categories into an array
  83.         $options_categories = array();
  84.         $options_categories_obj = get_categories();
  85.         foreach ($options_categories_obj as $category) {
  86.                 $options_categories[$category->cat_ID] = $category->cat_name;
  87.         }
  88.  
  89.         // Pull all tags into an array
  90.         $options_tags = array();
  91.         $options_tags_obj = get_tags();
  92.         foreach ( $options_tags_obj as $tag ) {
  93.                 $options_tags[$tag->term_id] = $tag->name;
  94.         }
  95.  
  96.         // Pull all the pages into an array
  97.         $options_pages = array();
  98.         $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
  99.         $options_pages[''] = 'Select a page:';
  100.         foreach ($options_pages_obj as $page) {
  101.                 $options_pages[$page->ID] = $page->post_title;
  102.         }
  103.  
  104.                 // Pull all the pages into an array
  105.                 // $options_slider = array();
  106.                 // $options_slider_obj = get_posts('post_type=custom_slider');
  107.                 // $options_slider[''] = 'Select a slider:';
  108.                 // foreach ($options_slider_obj as $post) {
  109.                 //  $options_slider[$post->ID] = $post->post_title;
  110.                 // }
  111.  
  112.         // If using image radio buttons, define a directory path
  113.         $imagepath =  get_template_directory_uri() . '/images/';
  114.  
  115.                 // fixed or scroll position
  116.                 $fixed_scroll = array('scroll' => 'Scroll', 'fixed' => 'Fixed');
  117.  
  118.                 $options = array();
  119.  
  120.                 $options[] = array( 'name' => __('Main', 'dazzling'),
  121.                                                     'type' => 'heading');
  122.  
  123.                 $options[] = array( 'name' => __('Do You want to display image slider on the Home Page?','dazzling'),
  124.                                                     'desc' => __('Check if you want to enable slider', 'dazzling'),
  125.                                                     'id' => 'dazzling_slider_checkbox',
  126.                                                     'std' => 1,
  127.                                                     'type' => 'checkbox');
  128.  
  129.                 $options[] = array( 'name' => __('Slider Category', 'dazzling'),
  130.                                                     'desc' => __('Select a category for the featured post slider', 'dazzling'),
  131.                                                     'id' => 'dazzling_slide_categories',
  132.                                                     'type' => 'select',
  133.                                                     'class' => 'hidden',
  134.                                                     'options' => $options_categories);
  135.  
  136.                 $options[] = array( 'name' => __('Number of slide items', 'dazzling'),
  137.                                                     'desc' => __('Enter the number of slide items', 'dazzling'),
  138.                                                     'id' => 'dazzling_slide_number',
  139.                                                     'std' => '3',
  140.                                                     'class' => 'hidden',
  141.                                                     'type' => 'text');
  142.  
  143.                 $options[] = array( 'name' => __('Website Layout Options', 'dazzling'),
  144.                                                     'desc' => __('Choose between Left and Right sidebar options to be used as default', 'dazzling'),
  145.                                                     'id' => 'site_layout',
  146.                                                     'std' => 'pull-left',
  147.                                                     'type' => 'select',
  148.                                                     'class' => 'mini',
  149.                                                     'options' => $site_layout);
  150.  
  151.                 $options[] = array( 'name' => __('Element color', 'dazzling'),
  152.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  153.                                                     'id' => 'element_color',
  154.                                                     'std' => '',
  155.                                                     'type' => 'color');
  156.  
  157.                 $options[] = array( 'name' => __('Element color on hover', 'dazzling'),
  158.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  159.                                                     'id' => 'element_color_hover',
  160.                                                     'std' => '',
  161.                                                     'type' => 'color');
  162.  
  163.                 $options[] = array( 'name' => __('Custom Favicon', 'dazzling'),
  164.                                                     'desc' => __('Upload a 32px x 32px PNG/GIF image that will represent your websites favicon', 'dazzling'),
  165.                                                     'id' => 'custom_favicon',
  166.                                                     'std' => '',
  167.                                                     'type' => 'upload');
  168.  
  169.                 $options[] = array( 'name' => __('Action Button', 'dazzling'),
  170.                                                     'type' => 'heading');
  171.  
  172.                 $options[] = array( 'name' => __('Call For Action Text', 'dazzling'),
  173.                                                     'desc' => __('Enter the text for call for action section', 'dazzling'),
  174.                                                     'id' => 'w2f_cfa_text',
  175.                                                     'std' => '',
  176.                                                     'type' => 'textarea');
  177.  
  178.                 $options[] = array( 'name' => __('Call For Action Button Title', 'dazzling'),
  179.                                                     'desc' => __('Enter the title for Call For Action button', 'dazzling'),
  180.                                                     'id' => 'w2f_cfa_button',
  181.                                                     'std' => '',
  182.                                                     'type' => 'text');
  183.  
  184.                 $options[] = array( 'name' => __('CFA button link', 'dazzling'),
  185.                                                     'desc' => __('Enter the link for Call For Action button', 'dazzling'),
  186.                                                     'id' => 'w2f_cfa_link',
  187.                                                     'std' => '',
  188.                                                     'type' => 'text');
  189.  
  190.                 $options[] = array( 'name' => __('Call For Action Text Color', 'dazzling'),
  191.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  192.                                                     'id' => 'cfa_color',
  193.                                                     'std' => '',
  194.                                                     'type' => 'color');
  195.  
  196.                 $options[] = array( 'name' => __('Call For Action Background Color', 'dazzling'),
  197.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  198.                                                     'id' => 'cfa_bg_color',
  199.                                                     'std' => '',
  200.                                                     'type' => 'color');
  201.  
  202.                 $options[] = array( 'name' => __('Call For Action Button Border Color', 'dazzling'),
  203.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  204.                                                     'id' => 'cfa_btn_color',
  205.                                                     'std' => '',
  206.                                                     'type' => 'color');
  207.  
  208.                 $options[] = array( 'name' => __('Call For Action Button Text Color', 'dazzling'),
  209.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  210.                                                     'id' => 'cfa_btn_txt_color',
  211.                                                     'std' => '',
  212.                                                     'type' => 'color');
  213.  
  214.                 $options[] = array( 'name' => __('Typography', 'dazzling'),
  215.                                                     'type' => 'heading');
  216.  
  217.                 $options[] = array( 'name' => __('Main Body Text', 'dazzling'),
  218.                                                     'desc' => __('Used in P tags', 'dazzling'),
  219.                                                     'id' => 'main_body_typography',
  220.                                                     'std' => $typography_defaults,
  221.                                                     'type' => 'typography',
  222.                                                     'options' => $typography_options);
  223.  
  224.                 $options[] = array( 'name' => __('Heading Color', 'dazzling'),
  225.                                                     'desc' => __('Color for all headings (h1-h6)', 'dazzling'),
  226.                                                     'id' => 'heading_color',
  227.                                                     'std' => '',
  228.                                                     'type' => 'color');
  229.  
  230.                 $options[] = array( 'name' => __('Link Color', 'dazzling'),
  231.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  232.                                                     'id' => 'link_color',
  233.                                                     'std' => '',
  234.                                                     'type' => 'color');
  235.  
  236.                 $options[] = array( 'name' => __('Link:hover Color', 'dazzling'),
  237.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  238.                                                     'id' => 'link_hover_color',
  239.                                                     'std' => '',
  240.                                                     'type' => 'color');
  241.  
  242.                 $options[] = array( 'name' => __('Link:active Color', 'dazzling'),
  243.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  244.                                                     'id' => 'link_active_color',
  245.                                                     'std' => '',
  246.                                                     'type' => 'color');
  247.  
  248.                 $options[] = array( 'name' => __('Header', 'dazzling'),
  249.                                                     'type' => 'heading');
  250.  
  251.                 $options[] = array( 'name' => __('Top nav background color', 'dazzling'),
  252.                                                     'desc' => __('Default used if no color is selected.', 'dazzling'),
  253.                                                     'id' => 'top_nav_bg_color',
  254.                                                     'std' => '',
  255.                                                     'type' => 'color');
  256.  
  257.                 $options[] = array( 'name' => __('Top nav item color', 'dazzling'),
  258.                                                     'desc' => __('Link color', 'dazzling'),
  259.                                                     'id' => 'top_nav_link_color',
  260.                                                     'std' => '',
  261.                                                     'type' => 'color');
  262.  
  263.                 $options[] = array( 'name' => __('Top nav dropdown background color', 'dazzling'),
  264.                                                     'desc' => __('Background of dropdown item hover color', 'dazzling'),
  265.                                                     'id' => 'top_nav_dropdown_bg',
  266.                                                     'std' => '',
  267.                                                     'type' => 'color');
  268.  
  269.                 $options[] = array( 'name' => __('Top nav dropdown item color', 'dazzling'),
  270.                                                     'desc' => __('Dropdown item color', 'dazzling'),
  271.                                                     'id' => 'top_nav_dropdown_item',
  272.                                                     'std' => '',
  273.                                                     'type' => 'color');
  274.  
  275.                 $options[] = array( 'name' => __('Footer', 'dazzling'),
  276.                                                     'type' => 'heading');
  277.  
  278.                 $options[] = array( 'name' => __('Footer Widget Area Background Color', 'dazzling'),
  279.                                                     'id' => 'footer_widget_bg_color',
  280.                                                     'std' => '',
  281.                                                     'type' => 'color');
  282.  
  283.                 $options[] = array( 'name' => __('Footer Background Color', 'dazzling'),
  284.                                                     'id' => 'footer_bg_color',
  285.                                                     'std' => '',
  286.                                                     'type' => 'color');
  287.  
  288.                 $options[] = array( 'name' => __('Footer Text Color', 'dazzling'),
  289.                                                     'id' => 'footer_text_color',
  290.                                                     'std' => '',
  291.                                                     'type' => 'color');
  292.  
  293.                 $options[] = array( 'name' => __('Footer Link Color', 'dazzling'),
  294.                                                     'id' => 'footer_link_color',
  295.                                                     'std' => '',
  296.                                                     'type' => 'color');
  297.  
  298.                 $options[] = array( 'name' => __('Footer information', 'dazzling'),
  299.                                     'desc' => __('Copyright text in footer', 'dazzling'),
  300.                                     'id' => 'custom_footer_text',
  301.                                     'std' => '<a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" >' . get_bloginfo( 'name', 'display' ) . '</a> '. __('All rights reserved.', 'dazzling'),
  302.                                     'type' => 'textarea');
  303.  
  304.                 $options[] = array( 'name' => __('Social', 'dazzling'),
  305.                                                 'type' => 'heading');
  306.  
  307.                 $options[] = array( 'name' => __('Social Icon Color', 'dazzling'),
  308.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  309.                                                     'id' => 'social_color',
  310.                                                     'std' => '',
  311.                                                     'type' => 'color');
  312.  
  313.                 $options[] = array( 'name' => __('Social Icon:hover Color', 'dazzling'),
  314.                                                     'desc' => __('Default used if no color is selected', 'dazzling'),
  315.                                                     'id' => 'social_hover_color',
  316.                                                     'std' => '',
  317.                                                     'type' => 'color');
  318.  
  319.                 $options[] = array( 'name' => __('Add full URL for your social network profiles', 'dazzling'),
  320.                                     'desc' => __('Facebook', 'dazzling'),
  321.                                     'id' => 'social_facebook',
  322.                                     'std' => '',
  323.                                     'class' => 'mini',
  324.                                     'type' => 'text');
  325.  
  326.                 $options[] = array( 'id' => 'social_twitter',
  327.                                                     'desc' => __('Twitter', 'dazzling'),
  328.                                     'std' => '',
  329.                                     'class' => 'mini',
  330.                                     'type' => 'text');
  331.  
  332.                 $options[] = array( 'id' => 'social_googleplus',
  333.                                                     'desc' => __('Google+', 'dazzling'),
  334.                                     'std' => '',
  335.                                     'class' => 'mini',
  336.                                     'type' => 'text');
  337.  
  338.                 $options[] = array( 'id' => 'social_youtube',
  339.                                                     'desc' => __('Youtube', 'dazzling'),
  340.                                     'std' => '',
  341.                                     'class' => 'mini',
  342.                                     'type' => 'text');
  343.  
  344.                 $options[] = array( 'id' => 'social_linkedin',
  345.                                                     'desc' => __('LinkedIn', 'dazzling'),
  346.                                     'std' => '',
  347.                                     'class' => 'mini',
  348.                                     'type' => 'text');
  349.  
  350.                 $options[] = array( 'id' => 'social_pinterest',
  351.                                                     'desc' => __('Pinterest', 'dazzling'),
  352.                                     'std' => '',
  353.                                     'class' => 'mini',
  354.                                     'type' => 'text');
  355.  
  356.                 $options[] = array( 'id' => 'social_rss',
  357.                                                     'desc' => __('RSS Feed', 'dazzling'),
  358.                                     'std' => '',
  359.                                     'class' => 'mini',
  360.                                     'type' => 'text');
  361.  
  362.                 $options[] = array( 'id' => 'social_tumblr',
  363.                                                     'desc' => __('Tumblr', 'dazzling'),
  364.                                     'std' => '',
  365.                                     'class' => 'mini',
  366.                                     'type' => 'text');
  367.  
  368.             $options[] = array( 'id' => 'social_flickr',
  369.                                                     'desc' => __('Flickr', 'dazzling'),
  370.                                         'std' => '',
  371.                                         'class' => 'mini',
  372.                                         'type' => 'text');
  373.  
  374.             $options[] = array( 'id' => 'social_instagram',
  375.                                                     'desc' => __('Instagram', 'dazzling'),
  376.                                         'std' => '',
  377.                                         'class' => 'mini',
  378.                                         'type' => 'text');
  379.  
  380.             $options[] = array( 'id' => 'social_dribbble',
  381.                                                     'desc' => __('Dribbble', 'dazzling'),
  382.                                         'std' => '',
  383.                                         'class' => 'mini',
  384.                                         'type' => 'text');
  385.  
  386.             $options[] = array( 'id' => 'social_skype',
  387.                                                     'desc' => __('Skype', 'dazzling'),
  388.                                         'std' => '',
  389.                                         'class' => 'mini',
  390.                                         'type' => 'text');
  391.  
  392.             $options[] = array( 'id' => 'social_github',
  393.                                                     'desc' => __('Github', 'dazzling'),
  394.                                         'std' => '',
  395.                                         'class' => 'mini',
  396.                                         'type' => 'text');
  397.  
  398.                 $options[] = array( 'name' => __('Other', 'dazzling'),
  399.                                                     'type' => 'heading');
  400.  
  401.                 $options[] = array( 'name' => __('Custom CSS', 'dazzling'),
  402.                                                     'desc' => __('Additional CSS', 'dazzling'),
  403.                                                     'id' => 'custom_css',
  404.                                                     'std' => '',
  405.                                                     'type' => 'textarea');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement