Advertisement
imranmodel32

SMOF BAckground image plus all

Sep 23rd, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.70 KB | None | 0 0
  1. <?php
  2. add_action('init','of_options');
  3. if (!function_exists('of_options'))
  4. {
  5. function of_options()
  6. {
  7. //Access the WordPress Categories via an Array
  8. $of_categories = array();
  9. $of_categories_obj = get_categories('hide_empty=0');
  10. foreach ($of_categories_obj as $of_cat) {
  11. $of_categories[$of_cat->cat_ID] = $of_cat->cat_name;}
  12. $categories_tmp = array_unshift($of_categories, "Select a category:");
  13.  
  14. //Access the WordPress Pages via an Array
  15. $of_pages = array();
  16. $of_pages_obj = get_pages('sort_column=post_parent,menu_order');
  17. foreach ($of_pages_obj as $of_page) {
  18. $of_pages[$of_page->ID] = $of_page->post_name; }
  19. $of_pages_tmp = array_unshift($of_pages, "Select a page:");
  20.  
  21. //Testing
  22. $of_options_select = array("one","two","three","four","five");
  23. $of_options_radio = array("one" => "One","two" => "Two","three" => "Three","four" => "Four","five" => "Five");
  24.  
  25. //Sample Homepage blocks for the layout manager (sorter)
  26. $of_options_homepage_blocks = array
  27. (
  28. "disabled" => array (
  29. "placebo" => "placebo", //REQUIRED!
  30. "block_one" => "Block One",
  31. "block_two" => "Block Two",
  32. "block_three" => "Block Three",
  33. ),
  34. "enabled" => array (
  35. "placebo" => "placebo", //REQUIRED!
  36. "block_four" => "Block Four",
  37. ),
  38. );
  39.  
  40.  
  41. //Stylesheets Reader
  42. $alt_stylesheet_path = LAYOUT_PATH;
  43. $alt_stylesheets = array();
  44.  
  45. if ( is_dir($alt_stylesheet_path) )
  46. {
  47. if ($alt_stylesheet_dir = opendir($alt_stylesheet_path) )
  48. {
  49. while ( ($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false )
  50. {
  51. if(stristr($alt_stylesheet_file, ".css") !== false)
  52. {
  53. $alt_stylesheets[] = $alt_stylesheet_file;
  54. }
  55. }
  56. }
  57. }
  58.  
  59.  
  60. //Background Images Reader
  61. $bg_images_path = get_stylesheet_directory(). '/images/bg/'; // change this to where you store your bg images
  62. $bg_images_url = get_template_directory_uri().'/images/bg/'; // change this to where you store your bg images
  63. $bg_images = array();
  64.  
  65. if ( is_dir($bg_images_path) ) {
  66. if ($bg_images_dir = opendir($bg_images_path) ) {
  67. while ( ($bg_images_file = readdir($bg_images_dir)) !== false ) {
  68. if(stristr($bg_images_file, ".png") !== false || stristr($bg_images_file, ".jpg") !== false) {
  69. $bg_images[] = $bg_images_url . $bg_images_file;
  70. }
  71. }
  72. }
  73. }
  74.  
  75.  
  76. /*-----------------------------------------------------------------------------------*/
  77. /* TO DO: Add options/functions that use these */
  78. /*-----------------------------------------------------------------------------------*/
  79.  
  80. //More Options
  81. $uploads_arr = wp_upload_dir();
  82. $all_uploads_path = $uploads_arr['path'];
  83. $all_uploads = get_option('of_uploads');
  84. $other_entries = array("Select a number:","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19");
  85. $body_repeat = array("no-repeat","repeat-x","repeat-y","repeat");
  86. $body_pos = array("top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right");
  87.  
  88. // Image Alignment radio box
  89. $of_options_thumb_align = array("alignleft" => "Left","alignright" => "Right","aligncenter" => "Center");
  90.  
  91. // Image Links to Options
  92. $of_options_image_link_to = array("image" => "The Image","post" => "The Post");
  93.  
  94.  
  95. /*-----------------------------------------------------------------------------------*/
  96. /* The Options Array */
  97. /*-----------------------------------------------------------------------------------*/
  98.  
  99. // Set the Options Array
  100. global $of_options;
  101. $of_options = array();
  102.  
  103. $of_options[] = array( "name" => "Home Settings",
  104. "type" => "heading"
  105. );
  106.  
  107. $of_options[] = array( "name" => "Hello there!",
  108. "desc" => "",
  109. "id" => "introduction",
  110. "std" => "<h3 style=\"margin: 0 0 10px;\">Welcome to the Theme Options.</h3>
  111. Please update your logo from here, you can also google analytics code and change other settings from here",
  112. "icon" => true,
  113. "type" => "info"
  114. );
  115.  
  116. $of_options[] = array( "name" => "Logo",
  117. "desc" => "Upload your logo",
  118. "id" => "logo",
  119. // Use the shortcodes [site_url] or [site_url_secure] for setting default URLs
  120. "std" => '',
  121. "type" => "upload"
  122. );
  123.  
  124.  
  125.  
  126. $of_options[] = array( "name" => "Toogle Settings",
  127. "desc" => "You can turn settings on and off from here",
  128. "id" => "toggleSettings",
  129. "std" => "75",
  130. "min" => "0",
  131. "step" => "5",
  132. "max" => "300",
  133. "type" => "spinner"
  134. );
  135.  
  136. $of_options[] = array( "name" => "Top Search Box",
  137. "desc" => "topsearchbox",
  138. "id" => "topsearchboxSwitch",
  139. "std" => 1,
  140. "type" => "switch"
  141. );
  142. $of_options[] = array( "name" => "Home Featured Posts",
  143. "desc" => "Wheather to display Two Featured Posts on Homepage or not",
  144. "id" => "HomeFeaturedPosts",
  145. "std" => 0,
  146. "type" => "switch"
  147. );
  148. $of_options[] = array( "name" => "Home Featured Post 1",
  149. "desc" => "Insert the Post id here",
  150. "id" => "HomeFeaturedPost1",
  151. "std" => '',
  152. "type" => "text"
  153. );
  154. $of_options[] = array( "name" => "Home Featured Post 2",
  155. "desc" => "Insert the Post id here",
  156. "id" => "HomeFeaturedPost2",
  157. "std" => '',
  158. "type" => "text"
  159. );
  160. $of_options[] = array( "name" => "Home Bottom Category",
  161. "desc" => "Wheather to display Two Featured Posts on Homepage",
  162. "id" => "HomeBottomCat",
  163. "std" => 0,
  164. "type" => "switch"
  165. );
  166. $of_options[] = array( "name" => "Tite of the Category",
  167. "desc" => "Insert the Title",
  168. "id" => "catonHomeBottomTitle",
  169. "std" => '',
  170. "type" => "text"
  171. );
  172. $of_options[] = array( "name" => "Which Category posts to show on Home Bottom",
  173. "desc" => "Insert the Posts ids here eg: 1, 3, 5",
  174. "id" => "catonHomeBottom",
  175. "std" => '',
  176. "type" => "text"
  177. );
  178.  
  179. $of_options[] = array( "name" => "Tracking Code",
  180. "desc" => "Paste your Google Analytics (or other) tracking code here. This will be added into the footer template of your theme.",
  181. "id" => "google_analytics",
  182. "std" => '',
  183. "type" => "textarea"
  184. );
  185.  
  186. $of_options[] = array( "name" => "Footer Text",
  187. "desc" => "Insert your Footer text, you can also include links here",
  188. "id" => "footer_text",
  189. "std" => "",
  190. "type" => "textarea"
  191. );
  192. $of_options[] = array( "name" => "Footer Links",
  193. "desc" => "Footer Links html",
  194. "id" => "footer_links",
  195. "std" => '',
  196. "type" => "textarea"
  197. );
  198.  
  199. $of_options[] = array( "name" => "Styling Options",
  200. "type" => "heading"
  201. );
  202.  
  203. $of_options[] = array( "name" => "Custom CSS",
  204. "desc" => "Quickly add some CSS to your theme by adding it to this block.",
  205. "id" => "custom_css",
  206. "std" => '',
  207. "type" => "textarea"
  208. );
  209.  
  210.  
  211. // Backup Options
  212. $of_options[] = array( "name" => "Backup Options",
  213. "type" => "heading",
  214. "icon" => ADMIN_IMAGES . "icon-slider.png"
  215. );
  216.  
  217. $of_options[] = array( "name" => "Backup and Restore Options",
  218. "id" => "of_backup",
  219. "std" => '',
  220. "type" => "backup",
  221. "desc" => 'You can use the two buttons below to backup your current options, and then restore it back at a later time. This is useful if you want to experiment on the options but would like to keep the old settings in case you need it back.',
  222. );
  223.  
  224. $of_options[] = array( "name" => "Transfer Theme Options Data",
  225. "id" => "of_transfer",
  226. "std" => '',
  227. "type" => "transfer",
  228. "desc" => 'You can tranfer the saved options data between different installs by copying the text inside the text box. To import data from another install, replace the data in the text box with the one from another install and click "Import Options".',
  229. );
  230.  
  231. }//End function: of_options()
  232. }//End chack if function exists: of_options()
  233. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement