Guest User

Untitled

a guest
Mar 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.34 KB | None | 0 0
  1. <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
  2.  
  3. function stock_theme_metabox($options){
  4. $options = array(); // remove old options
  5.  
  6. $options[] = array(
  7. 'id' => 'stock_page_options',
  8. 'title' => esc_html__('Page Options', 'stock-theme'),
  9. 'post_type' => 'page',
  10. 'context' => 'normal',
  11. 'priority' => 'high',
  12. 'sections' => array(
  13. array(
  14. 'name' => 'stock_page_options_meta',
  15. 'fields' => array(
  16. array(
  17. 'id' => 'enable_title',
  18. 'type' => 'switcher',
  19. 'title' => esc_html__('Enable title?', 'stock-theme'),
  20. 'desc' => esc_html__('If you want to enable title, select yes.', 'stock-theme')
  21. ),
  22. array(
  23. 'id' => 'custom_title',
  24. 'type' => 'text',
  25. 'title' => esc_html__('Custom title', 'stock-theme'),
  26. 'dependency' => array( 'enable_title', '==', 'true' ),
  27. 'desc' => esc_html__('If you want to enable title, select yes.', 'stock-theme')
  28. ),
  29.  
  30. ),
  31. ),
  32.  
  33. ),
  34. );
  35.  
  36.  
  37. // Slide options
  38. $options[] = array(
  39. 'id' => 'stock_slide_options',
  40. 'title' => esc_html__('Slide Options', 'stock-theme'),
  41. 'post_type' => 'slide',
  42. 'context' => 'normal',
  43. 'priority' => 'high',
  44. 'sections' => array(
  45. array(
  46. 'name' => 'stock_slide_options_meta',
  47. 'fields' => array(
  48. array(
  49. 'id' => 'buttons',
  50. 'type' => 'group',
  51. 'title' => esc_html__( 'Slides button', 'stock-theme' ),
  52. 'button_title' => esc_html__( 'Add New' ),
  53. 'accordion_title' => esc_html__( 'Add New Field' ),
  54. 'fields' => array(
  55. array(
  56. 'id' => 'type',
  57. 'type' => 'select',
  58. 'desc' => 'select button type',
  59. 'options' => array(
  60. 'bordered' => 'Bordered button',
  61. 'filled' => 'Filled button',
  62. ),
  63. 'title' => esc_html__( 'Button type', 'stock-theme' ),
  64. ),
  65. array(
  66. 'id' => 'text',
  67. 'type' => 'text',
  68. 'desc' => 'type button text',
  69. 'title' => esc_html__( 'Button text', 'stock-theme' ),
  70. 'default' => 'Get a free consultation',
  71. ),
  72. array(
  73. 'id' => 'link_type',
  74. 'type' => 'select',
  75. 'desc' => 'select link type',
  76. 'title' => esc_html__( 'Link type', 'stock-theme' ),
  77. 'options' => array(
  78. '1' => 'WordPress Page',
  79. '2' => 'External link',
  80. ),
  81. ),
  82. array(
  83. 'id' => 'link_to_page',
  84. 'type' => 'select',
  85. 'desc' => 'select wordpress page',
  86. 'title' => esc_html__( 'Select page', 'stock-theme' ),
  87. 'options' => 'page',
  88. 'dependency' => array( 'link_type', '==', '1' ),
  89. ),
  90. array(
  91. 'id' => 'link_to_external',
  92. 'type' => 'text',
  93. 'desc' => 'type external url',
  94. 'title' => esc_html__( 'Type URL', 'stock-theme' ),
  95. 'dependency' => array( 'link_type', '==', '2' ),
  96. ),
  97.  
  98. ),
  99. ),
  100.  
  101. // start enable overlay field
  102. array(
  103. 'id' => 'enable_overlay',
  104. 'type' => 'switcher',
  105. 'title' => esc_html__('Enable overlay'),
  106. 'desc' => 'if you want to enable overlay, select yes.',
  107. 'default' => true,
  108. ),
  109.  
  110. // start overlay percentage field
  111. array(
  112. 'id' => 'overlay_percentage',
  113. 'type' => 'text',
  114. 'default' => '.6',
  115. 'title' => esc_html__('Overlay percentage'),
  116. 'desc' => 'Type overlay percentage in floating number. Max value is 1.',
  117. 'dependency' => array('enable_overlay', '==', 'true' )
  118. ),
  119.  
  120. // start overlay color field
  121. array(
  122. 'id' => 'overlay_color',
  123. 'type' => 'color_picker',
  124. 'title' => esc_html__('Overlay Color'),
  125. 'desc' => 'Select your overlay color',
  126. 'default' => '#181a1f',
  127. 'dependency' => array('enable_overlay', '==', 'true' )
  128. ),
  129. ),
  130. ),
  131.  
  132. ),
  133. );
  134.  
  135. return $options;
  136. }
  137. add_filter( 'cs_metabox_options', 'stock_theme_metabox' );
  138.  
  139.  
  140. // Theme options
  141.  
  142. function stock_theme_options($options) {
  143. $options = array(); // remove old options
  144.  
  145. $options[] = array(
  146. 'name' => 'stock_theme_header_settings',
  147. 'title' => 'Header settings',
  148. 'icon' => 'fa fa-heart',
  149. 'fields' => array(
  150. array(
  151. 'id' => 'header_iconic_boxes',
  152. 'type' => 'group',
  153. 'title' => 'Iconic boxes',
  154. 'button_title' => 'Add New',
  155. 'accordion_title' => 'Add New box',
  156. 'fields' => array(
  157. array(
  158. 'id' => 'title',
  159. 'type' => 'text',
  160. 'title' => 'Title',
  161. ),
  162. array(
  163. 'id' => 'icon',
  164. 'type' => 'icon',
  165. 'title' => 'Box icon',
  166. 'desc' => 'Select box icon',
  167. ),
  168. array(
  169. 'id' => 'big_title',
  170. 'type' => 'text',
  171. 'title' => 'Big title',
  172. ),
  173. ),
  174. ),
  175. )
  176. );
  177.  
  178. $options[] = array(
  179. 'name' => 'stock_theme_social_settings',
  180. 'title' => 'Social links',
  181. 'icon' => 'fa fa-heart',
  182. 'fields' => array(
  183. array(
  184. 'id' => 'social_links',
  185. 'type' => 'group',
  186. 'title' => 'Social links',
  187. 'button_title' => 'Add New',
  188. 'accordion_title' => 'Add New link',
  189. 'fields' => array(
  190. array(
  191. 'id' => 'icon',
  192. 'type' => 'icon',
  193. 'title' => 'Icon',
  194. 'desc' => 'Select icon',
  195. ),
  196. array(
  197. 'id' => 'link',
  198. 'type' => 'text',
  199. 'title' => 'Link text',
  200. ),
  201. ),
  202. ),
  203. )
  204. );
  205.  
  206. $options[] = array(
  207. 'name' => 'stock_theme_logo_settings',
  208. 'title' => 'Logo settings',
  209. 'icon' => 'fa fa-heart',
  210. 'fields' => array(
  211. array(
  212. 'id' => 'enable_image_logo',
  213. 'type' => 'switcher',
  214. 'default' => false,
  215. 'title' => 'Enable image logo',
  216. ),
  217. array(
  218. 'id' => 'image_logo',
  219. 'type' => 'image',
  220. 'title' => 'Upload image logo',
  221. 'dependency' => array('enable_image_logo', '==', true),
  222. ),
  223. array(
  224. 'id' => 'text_logo',
  225. 'type' => 'text',
  226. 'title' => 'Logo text',
  227. 'default' => 'Stock',
  228. 'dependency' => array('enable_image_logo', '==', false),
  229. ),
  230. )
  231. );
  232.  
  233. $options[] = array(
  234. 'name' => 'stock_theme_typography_settings',
  235. 'title' => 'Typography settings',
  236. 'icon' => 'fa fa-heart',
  237. 'fields' => array(
  238. array(
  239. 'id' => 'body_font',
  240. 'type' => 'typography',
  241. 'title' => 'Body font',
  242. 'default' => array(
  243. 'family' => 'Roboto',
  244. 'variant' => 'regular',
  245. 'font' => 'google', // this is helper for output
  246. ),
  247. ),
  248. array(
  249. 'id' => 'heading_font',
  250. 'type' => 'typography',
  251. 'title' => 'Heading font',
  252. 'default' => array(
  253. 'family' => 'Noto Serif',
  254. 'variant' => '700',
  255. 'font' => 'google', // this is helper for output
  256. ),
  257. ),
  258. )
  259. );
  260.  
  261. $options[] = array(
  262. 'name' => 'stock_theme_styling_settings',
  263. 'title' => 'Styling settings',
  264. 'icon' => 'fa fa-heart',
  265. 'fields' => array(
  266. array(
  267. 'id' => 'enable_preloader',
  268. 'type' => 'switcher',
  269. 'title' => 'Enable preloader',
  270. 'default' => true,
  271. ),
  272. array(
  273. 'id' => 'enable_boxed_layout',
  274. 'type' => 'switcher',
  275. 'title' => 'Enable boxed layout',
  276. 'default' => false,
  277. ),
  278. array(
  279. 'id' => 'body_bg',
  280. 'type' => 'image',
  281. 'title' => 'Body background image',
  282. 'dependency' => array('enable_boxed_layout', '==', true),
  283. ),
  284. array(
  285. 'id' => 'body_bg_repeat',
  286. 'type' => 'select',
  287. 'title' => 'Body background repeat',
  288. 'options' => array(
  289. 'repeat' => 'Repeat',
  290. 'no-repeat' => 'No-repeat',
  291. 'cover' => 'Cover',
  292. ),
  293. 'default' => 'repeat',
  294. 'dependency' => array('enable_boxed_layout', '==', true),
  295. ),
  296. array(
  297. 'id' => 'body_bg_attachment',
  298. 'type' => 'select',
  299. 'title' => 'Body background attachment',
  300. 'options' => array(
  301. 'scroll' => 'Scroll',
  302. 'fixed' => 'Fixed',
  303. ),
  304. 'default' => 'scroll',
  305. 'dependency' => array('enable_boxed_layout', '==', true),
  306. ),
  307. )
  308. );
  309.  
  310. $options[] = array(
  311. 'name' => 'stock_theme_blog_settings',
  312. 'title' => 'Blog settings',
  313. 'icon' => 'fa fa-heart',
  314. 'fields' => array(
  315. array(
  316. 'id' => 'display_post_by',
  317. 'type' => 'switcher',
  318. 'title' => 'Display post by?',
  319. 'default' => true,
  320. ),
  321. array(
  322. 'id' => 'display_post_date',
  323. 'type' => 'switcher',
  324. 'title' => 'Display post date?',
  325. 'default' => true,
  326. ),
  327. array(
  328. 'id' => 'display_post_comment_count',
  329. 'type' => 'switcher',
  330. 'title' => 'Display comment count?',
  331. 'default' => true,
  332. ),
  333. array(
  334. 'id' => 'display_post_category',
  335. 'type' => 'switcher',
  336. 'title' => 'Display posted in categories?',
  337. 'default' => true,
  338. ),
  339. array(
  340. 'id' => 'display_post_tag',
  341. 'type' => 'switcher',
  342. 'title' => 'Display posted in tags?',
  343. 'default' => true,
  344. ),
  345. array(
  346. 'id' => 'display_post_nav',
  347. 'type' => 'switcher',
  348. 'title' => 'Display next previous link on single post?',
  349. 'default' => true,
  350. ),
  351. )
  352. );
  353.  
  354. $options[] = array(
  355. 'name' => 'stock_theme_footer_settings',
  356. 'title' => 'Footer settings',
  357. 'icon' => 'fa fa-heart',
  358. 'fields' => array(
  359. array(
  360. 'id' => 'footer_bg',
  361. 'type' => 'color_picker',
  362. 'title' => 'Footer background color',
  363. 'default' => '#2a2d2f',
  364. ),
  365. array(
  366. 'id' => 'footer_text_color',
  367. 'type' => 'color_picker',
  368. 'title' => 'Footer text color',
  369. 'default' => '#8e9397',
  370. ),
  371. array(
  372. 'id' => 'footer_heading_color',
  373. 'type' => 'color_picker',
  374. 'title' => 'Footer heading color',
  375. 'default' => '#ffffff',
  376. ),
  377. array(
  378. 'id' => 'footer_copyright_text',
  379. 'type' => 'textarea',
  380. 'title' => 'Footer copyright text',
  381. 'default' => 'Copyright &copy; 2017 FairDealLab - All Rights Reserved',
  382. ),
  383. )
  384. );
  385.  
  386.  
  387. $options[] = array(
  388. 'name' => 'stock_theme_scripts_settings',
  389. 'title' => 'Script settings',
  390. 'icon' => 'fa fa-heart',
  391. 'fields' => array(
  392. array(
  393. 'id' => 'head_scripts',
  394. 'type' => 'textarea',
  395. 'title' => 'Head scripts',
  396. 'sanitize' => false,
  397. 'desc' => 'Scripts goes before closing head tag.'
  398. ),
  399. array(
  400. 'id' => 'body_scripts',
  401. 'type' => 'textarea',
  402. 'title' => 'Body scripts',
  403. 'sanitize' => false,
  404. 'desc' => 'Scripts goes after opening body tag.'
  405. ),
  406. array(
  407. 'id' => 'body_end_scripts',
  408. 'type' => 'textarea',
  409. 'title' => 'Footer scripts',
  410. 'sanitize' => false,
  411. 'desc' => 'Scripts goes before closing body tag.'
  412. ),
  413. )
  414. );
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421. return $options;
  422.  
  423.  
  424. }
  425.  
  426.  
  427. add_filter( 'cs_framework_options', 'stock_theme_options' );
Add Comment
Please, Sign In to add comment