Guest User

Untitled

a guest
Nov 25th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.71 KB | None | 0 0
  1. <?php
  2. function wallstreet_service_customizer( $wp_customize ) {
  3.  
  4. //Service section panel
  5. $wp_customize->add_panel( 'wallstreet_service_options', array(
  6. 'priority' => 600,
  7. 'capability' => 'edit_theme_options',
  8. 'title' => __('Service settings', 'wallstreet'),
  9. ) );
  10.  
  11.  
  12. $wp_customize->add_section( 'service_section_head' , array(
  13. 'title' => __('Service heading', 'wallstreet'),
  14. 'panel' => 'wallstreet_service_options',
  15. 'priority' => 50,
  16. ) );
  17.  
  18.  
  19. //Number of services
  20.  
  21. $wp_customize->add_setting(
  22. 'wallstreet_pro_options[service_list]',
  23. array(
  24. 'default' => 3,
  25. 'type' => 'option',
  26. 'sanitize_callback' => '',
  27.  
  28. )
  29. );
  30.  
  31. $wp_customize->add_control(
  32. 'wallstreet_pro_options[service_list]',
  33. array(
  34. 'type' => 'select',
  35. 'label' => __('Number of services on service section','wallstreet'),
  36. 'section' => 'service_section_head',
  37. 'priority' => 50,
  38. 'choices' => array(3=>3,6=>6,9=>9,12=>12,15=>15,18=>18,21=>21,24=>24),
  39. ));
  40.  
  41.  
  42. //Sarvice title
  43. $wp_customize->add_setting(
  44. 'wallstreet_pro_options[service_title]',
  45. array(
  46. 'default' => __('Our Services','wallstreet'),
  47. 'capability' => 'edit_theme_options',
  48. 'sanitize_callback' => '',
  49. 'type' => 'option'
  50. )
  51. );
  52. $wp_customize->add_control(
  53. 'wallstreet_pro_options[service_title]',
  54. array(
  55. 'label' => __('Title','wallstreet'),
  56. 'section' => 'service_section_head',
  57. 'type' => 'text',
  58. 'priority' => 100,
  59. )
  60. );
  61.  
  62. $wp_customize->add_setting(
  63. 'wallstreet_pro_options[service_description]',
  64. array(
  65. 'default' => __('We offer great services to our clients','wallstreet'),
  66. 'sanitize_callback' => '',
  67. 'type' => 'option'
  68. )
  69. );
  70. $wp_customize->add_control(
  71. 'wallstreet_pro_options[service_description]',
  72. array(
  73. 'label' => __('Description','wallstreet'),
  74. 'section' => 'service_section_head',
  75. 'type' => 'text',
  76. 'sanitize_callback' => '',
  77. 'priority' => 200,
  78. )
  79. );
  80.  
  81. //Add Service setting
  82. class WP_service_Customize_Control extends WP_Customize_Control {
  83. public $type = 'new_menu';
  84. /**
  85. * Render the control's content.
  86. */
  87. public function render_content() {
  88. ?>
  89. <a href="<?php bloginfo ( 'url' );?>/wp-admin/edit.php?post_type=wallstreet_service" class="button" target="_blank"><?php _e( 'Click here to add service', 'wallstreet' ); ?></a>
  90. <?php
  91. }
  92. }
  93.  
  94. $wp_customize->add_setting(
  95. 'service',
  96. array(
  97. 'default' => '',
  98. 'capability' => 'edit_theme_options',
  99. 'sanitize_callback' => '',
  100. )
  101. );
  102. $wp_customize->add_control( new WP_service_Customize_Control( $wp_customize, 'service', array(
  103. 'section' => 'service_section_head',
  104. 'priority' => 300,
  105. ))
  106. );
  107.  
  108. //Other service section
  109. $wp_customize->add_section( 'other_service_section' , array(
  110. 'title' => __('Other services section', 'wallstreet'),
  111. 'panel' => 'wallstreet_service_options',
  112. 'priority' => 50,
  113. ) );
  114.  
  115. //Enable . disbaled other services
  116. $wp_customize->add_setting(
  117. 'wallstreet_pro_options[other_service_section_enabled]',
  118. array(
  119. 'default' => true,
  120. 'capability' => 'edit_theme_options',
  121. 'sanitize_callback' => '',
  122. 'type' => 'option',
  123. )
  124. );
  125. $wp_customize->add_control(
  126. 'wallstreet_pro_options[other_service_section_enabled]',
  127. array(
  128. 'label' => __('Enable other services section in service template','wallstreet'),
  129. 'section' => 'other_service_section',
  130. 'type' => 'checkbox',
  131. 'priority' => 50,
  132. ));
  133.  
  134. //Sarvice title
  135. $wp_customize->add_setting(
  136. 'wallstreet_pro_options[other_service_title]',
  137. array(
  138. 'default' => __('Other services','wallstreet'),
  139. 'capability' => 'edit_theme_options',
  140. 'sanitize_callback' => '',
  141. 'type' => 'option'
  142. )
  143. );
  144. $wp_customize->add_control(
  145. 'wallstreet_pro_options[other_service_title]',
  146. array(
  147. 'label' => __('Title','wallstreet'),
  148. 'section' => 'other_service_section',
  149. 'type' => 'text',
  150. 'priority' => 100,
  151. )
  152. );
  153.  
  154. //other service description
  155.  
  156. //Sarvice title
  157. $wp_customize->add_setting(
  158. 'wallstreet_pro_options[other_service_description]',
  159. array(
  160. 'default' => __('We offer great services to our clients','wallstreet'),
  161. 'capability' => 'edit_theme_options',
  162. 'sanitize_callback' => '',
  163. 'type' => 'option'
  164. )
  165. );
  166. $wp_customize->add_control(
  167. 'wallstreet_pro_options[other_service_description]',
  168. array(
  169. 'label' => __('Description','wallstreet'),
  170. 'section' => 'other_service_section',
  171. 'type' => 'text',
  172. 'priority' => 100,
  173. )
  174. );
  175.  
  176. //Add Service setting
  177. class WP_other_service_Customize_Control extends WP_Customize_Control {
  178. public $type = 'new_menu';
  179. /**
  180. * Render the control's content.
  181. */
  182. public function render_content() {
  183. ?>
  184. <a href="<?php bloginfo ( 'url' );?>/wp-admin/edit.php?post_type=wallstreet_service" class="button" target="_blank"><?php _e( 'Click here to add service', 'wallstreet' ); ?></a>
  185. <?php
  186. }
  187. }
  188.  
  189. $wp_customize->add_setting(
  190. 'other_service',
  191. array(
  192. 'default' => '',
  193. 'capability' => 'edit_theme_options',
  194. 'sanitize_callback' => '',
  195. )
  196. );
  197. $wp_customize->add_control( new WP_other_service_Customize_Control( $wp_customize, 'other_service', array(
  198. 'section' => 'other_service_section',
  199. 'priority' => 300,
  200. ))
  201. );
  202.  
  203.  
  204. //Service callout
  205.  
  206. $wp_customize->add_section(
  207. 'service_callout_settings',
  208. array(
  209. 'title' => __('Service callout settings','wallstreet'),
  210. 'description' => '',
  211. 'panel' => 'wallstreet_service_options',)
  212. );
  213.  
  214.  
  215. //Enable and disabled service callout Section
  216.  
  217. $wp_customize->add_setting(
  218. 'wallstreet_pro_options[call_out_area_enabled]',
  219. array(
  220. 'default' => true,
  221. 'capability' => 'edit_theme_options',
  222. 'sanitize_callback' => '',
  223. 'type' => 'option',
  224. )
  225. );
  226. $wp_customize->add_control(
  227. 'wallstreet_pro_options[call_out_area_enabled]',
  228. array(
  229. 'label' => __('Enable Callout area section','wallstreet'),
  230. 'section' => 'service_callout_settings',
  231. 'type' => 'checkbox',
  232. )
  233. );
  234.  
  235. // add section to manage callout
  236. $wp_customize->add_setting(
  237. 'wallstreet_pro_options[call_out_title]',
  238. array(
  239. 'default' => __('Wallstreet is an elegant and modern theme for business websites.','wallstreet'),
  240. 'capability' => 'edit_theme_options',
  241. 'sanitize_callback' => '',
  242. 'type' => 'option',
  243. )
  244. );
  245. $wp_customize->add_control( 'wallstreet_pro_options[call_out_title]',array(
  246. 'label' => __('Title','wallstreet'),
  247. 'section' => 'service_callout_settings',
  248. 'type' => 'text',) );
  249.  
  250.  
  251. $wp_customize->add_setting(
  252. 'wallstreet_pro_options[call_out_text]',
  253. array(
  254. 'default' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eros elit, pretium et adipiscing vel, consectetur adipiscing elit.',
  255. 'capability' => 'edit_theme_options',
  256. 'sanitize_callback' => '',
  257. 'type' => 'option',
  258. )
  259. );
  260. $wp_customize->add_control('wallstreet_pro_options[call_out_text]',array(
  261. 'label' => __('Description','wallstreet'),
  262. 'section' => 'service_callout_settings',
  263. 'type' => 'text',) );
  264.  
  265.  
  266. $wp_customize ->add_setting (
  267. 'wallstreet_pro_options[call_out_button_text]',
  268. array(
  269. 'default' => __('Purchase Now','wallstreet'),
  270. 'capability' => 'edit_theme_options',
  271. 'sanitize_callback' => '',
  272. 'type' => 'option',
  273. )
  274. );
  275.  
  276. $wp_customize->add_control (
  277. 'wallstreet_pro_options[call_out_button_text]',
  278. array (
  279. 'label' => __('Button Text','wallstreet'),
  280. 'section' => 'service_callout_settings',
  281. 'type' => 'text',
  282. ) );
  283.  
  284. $wp_customize ->add_setting (
  285. 'wallstreet_pro_options[call_out_button_link]',
  286. array(
  287. 'default' => '#',
  288. 'capability' => 'edit_theme_options',
  289. 'sanitize_callback' => '',
  290. 'type' => 'option',
  291. ) );
  292.  
  293. $wp_customize->add_control (
  294. 'wallstreet_pro_options[call_out_button_link]',
  295. array (
  296.  
  297. 'label' => __('Button Link','wallstreet'),
  298. 'section' => 'service_callout_settings',
  299. 'type' => 'text',
  300. ) );
  301.  
  302. $wp_customize->add_setting(
  303. 'wallstreet_pro_options[call_out_button_link_target]',
  304. array('capability' => 'edit_theme_options',
  305. 'sanitize_callback' => '',
  306. 'type' => 'option',
  307. 'default' => true,
  308. ));
  309.  
  310. $wp_customize->add_control(
  311. 'wallstreet_pro_options[call_out_button_link_target]',
  312. array(
  313. 'type' => 'checkbox',
  314. 'label' => __('Open link in new tab','wallstreet'),
  315. 'section' => 'service_callout_settings',
  316. )
  317. );
  318.  
  319. }
  320. add_action( 'customize_register', 'wallstreet_service_customizer' );
  321. ?>
Add Comment
Please, Sign In to add comment