options.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. function optionsframework_option_name() {
  3. // This gets the theme name from the stylesheet
  4. $themename = get_option( 'stylesheet' );
  5. $themename = preg_replace("/\W/", "_", strtolower($themename) );
  6. $optionsframework_settings = get_option( 'optionsframework' );
  7. $optionsframework_settings['id'] = $themename;
  8. update_option( 'optionsframework', $optionsframework_settings );
  9. }
  10. /**
  11. * Defines an array of options that will be used to generate the settings page and be saved in the database.
  12. *
  13. */
  14. function optionsframework_options() {
  15. $social = array(
  16. 'foto_post' => __( 'Single post', 'foto' ),
  17. 'foto_page' => __( 'Page', 'foto' ),
  18. 'foto_both' => __( 'Both', 'foto' ),
  19. 'foto_none' => __( 'None', 'foto' )
  20. );
  21. $numbers = array(
  22. '2' => __( 'Two', 'foto' ),
  23. '3' => __( 'Three', 'foto' ),
  24. '4' => __( 'Four', 'foto' ),
  25. '5' => __( 'Five', 'foto' ),
  26. '6' => __( 'Six', 'foto' ),
  27. '7' => __( 'Seven', 'foto' ),
  28. '8' => __( 'Eight', 'foto' ),
  29. '9' => __( 'Nine', 'foto' ),
  30. '10' => __( 'Ten', 'foto' )
  31. );
  32. $options = array();
  33. $options[] = array(
  34. 'name' => __( 'General', 'foto' ),
  35. 'type' => 'heading');
  36. $options[] = array(
  37. 'name' => __( 'Custom Logo', 'foto' ),
  38. 'desc' => __( 'Upload a logo for your website, or specify the image address of your online logo. Recommended size is 300x100', 'foto' ),
  39. 'id' => 'foto_custom_logo',
  40. 'type' => 'upload');
  41. $options[] = array(
  42. 'name' => __( 'Custom Favicon', 'foto' ),
  43. 'desc' => __( 'Upload a favicon for your website, or specify the image address of your online favicon. Recommended size is 16x16', 'foto' ),
  44. 'id' => 'foto_custom_favicon',
  45. 'type' => 'upload');
  46. $options[] = array(
  47. 'name' => __( 'Custom CSS', 'foto' ),
  48. 'desc' => __( 'Quickly add some CSS rules to your theme by adding it to this box.', 'foto' ),
  49. 'id' => 'foto_custom_css',
  50. 'std' => '',
  51. 'type' => 'textarea');
  52. $options[] = array(
  53. 'name' => __( 'Analytic Code', 'foto' ),
  54. 'desc' => __( 'Paste your Google Analytics (or other) tracking code here. It will be inserted before the closing body tag of your theme.', 'foto' ),
  55. 'id' => 'foto_analytic_code',
  56. 'type' => 'textarea');
  57. /* ============================== End General Settings ================================= */
  58. $options[] = array(
  59. 'name' => __( 'Theme', 'foto' ),
  60. 'type' => 'heading');
  61. $options[] = array(
  62. 'name' => __( 'Welcome Text', 'foto' ),
  63. 'desc' => __( 'Put your welcome text here, it only visible on home page', 'foto' ),
  64. 'std' => 'Hi! Welcome to my personal photo site. This is just a place for me to share my photos. I hope you&rsquo;t ll enjoy it.',
  65. 'id' => 'foto_welcome_text',
  66. 'type' => 'textarea');
  67. $options[] = array(
  68. 'name' => __( 'Featured posts slider', 'foto' ),
  69. 'desc' => __( 'Check this option to show featured posts on home page. Featured posts is based on sticky post. To show the featured posts, you only need create a post then check the sticky post option.', 'foto' ),
  70. 'id' => 'foto_show_featured',
  71. 'type' => 'checkbox'
  72. );
  73. $options[] = array(
  74. 'name' => __( 'Select a number of featured posts', 'foto' ),
  75. 'desc' => __( 'How many featured posts you want to show ?', 'foto' ),
  76. 'id' => 'foto_featured',
  77. 'class' => 'hidden',
  78. 'type' => 'select',
  79. 'std' => '3',
  80. 'options' => $numbers );
  81. /* ============================== End Theme Settings ================================= */
  82. $options[] = array(
  83. 'name' => __( 'Social', 'foto' ),
  84. 'type' => 'heading');
  85. $options[] = array(
  86. 'name' => __( 'Custom RSS Feed', 'foto' ),
  87. 'desc' => __( 'You can put the feedburner link here', 'foto' ),
  88. 'id' => 'foto_rss_custom',
  89. 'type' => 'text');
  90. $options[] = array(
  91. 'name' => __( 'Twitter', 'foto' ),
  92. 'desc' => __( 'Twitter url. ex: http://twitter.com/yourusername', 'foto' ),
  93. 'id' => 'foto_twitter_username',
  94. 'type' => 'text');
  95. $options[] = array(
  96. 'name' => __( 'Facebook', 'foto' ),
  97. 'desc' => __( 'Facebook url. ex: http://www.facebook.com/yourusername', 'foto' ),
  98. 'id' => 'foto_fb_username',
  99. 'type' => 'text');
  100. $options[] = array(
  101. 'name' => __( 'Google Plus', 'foto' ),
  102. 'desc' => __( 'Google plus url. ex: https://plus.google.com/u/109253446701726260861', 'foto' ),
  103. 'id' => 'foto_gplus_username',
  104. 'type' => 'text');
  105. /* ============================== End Social Settings ================================= */
  106. return $options;
  107. }
  108. /**
  109. * Custom script for theme options
  110. *
  111. * @since 0.0.1
  112. */
  113. function foto_custom_scripts() { ?>
  114. <script type='text/javascript'>
  115. jQuery(document).ready(function($) {
  116. $('#foto_show_featured').click(function() {
  117. $('#section-foto_featured').fadeToggle(400);
  118. });
  119. if ($('#foto_show_featured:checked').val() !== undefined) {
  120. $('#section-foto_featured').show();
  121. }
  122. });
  123. </script>
  124. <?php
  125. }
  126. add_action( 'optionsframework_custom_scripts', 'foto_custom_scripts' );
  127. ?>