Advertisement
Guest User

Untitled

a guest
Sep 14th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.36 KB | None | 0 0
  1. <?php
  2. function rambo_home_page_customizer( $wp_customize ) {
  3. /* Header Section */
  4. $wp_customize->add_panel( 'home_page_setting', array(
  5. 'capability' => 'edit_theme_options',
  6. 'priority' => 250,
  7. 'title' => __('Home Page Settings', 'rambo'),
  8. ) );
  9.  
  10. $wp_customize->add_section(
  11. 'slider_section_settings',
  12. array(
  13. 'title' => __('Slider Setting','rambo'),
  14. 'description' => '',
  15. 'panel' => 'home_page_setting',)
  16. );
  17.  
  18. //Hide slider
  19.  
  20. $wp_customize->add_setting(
  21. 'rambo_pro_theme_options[home_slider_enabled]',
  22. array(
  23. 'default' => true,
  24. 'capability' => 'edit_theme_options',
  25. 'sanitize_callback' => 'sanitize_text_field',
  26. 'type' => 'option',
  27. )
  28. );
  29. $wp_customize->add_control(
  30. 'rambo_pro_theme_options[home_slider_enabled]',
  31. array(
  32. 'label' => __('Enable slider on front page','rambo'),
  33. 'section' => 'slider_section_settings',
  34. 'type' => 'checkbox',
  35. 'priority' => 100,
  36. ));
  37. //Slider animation
  38.  
  39. $wp_customize->add_setting(
  40. 'rambo_pro_theme_options[animation]',
  41. array(
  42. 'default' => __('slide','rambo'),
  43. 'type' => 'option',
  44. 'sanitize_callback' => 'sanitize_text_field',
  45.  
  46. )
  47. );
  48.  
  49. $wp_customize->add_control(
  50. 'rambo_pro_theme_options[animation]',
  51. array(
  52. 'type' => 'select',
  53. 'label' => __('Select slider Animation','rambo'),
  54. 'section' => 'slider_section_settings',
  55. 'priority' => 200,
  56. 'choices' => array('slide'=>__('slide', 'rambo'), 'fade'=>__('fade', 'rambo')),
  57. ));
  58.  
  59.  
  60. //Slider animation
  61.  
  62. $wp_customize->add_setting(
  63. 'rambo_pro_theme_options[slide_direction]',
  64. array(
  65. 'default' => __('slide','rambo'),
  66. 'type' => 'option',
  67. 'sanitize_callback' => 'sanitize_text_field',
  68.  
  69. )
  70. );
  71.  
  72. $wp_customize->add_control(
  73. 'rambo_pro_theme_options[slide_direction]',
  74. array(
  75. 'type' => 'select',
  76. 'label' => __('Slide direction','rambo'),
  77. 'section' => 'slider_section_settings',
  78. 'priority' => 250,
  79. 'choices' => array('horizontal'=>__('horizontal', 'rambo'), 'vertical'=>__('vertical', 'rambo')),
  80. ));
  81.  
  82. $wp_customize->add_setting(
  83. 'rambo_pro_theme_options[slideshowSpeed]',
  84. array(
  85. 'default' => __('2000','rambo'),
  86. 'type' => 'option',
  87. 'sanitize_callback' => 'sanitize_text_field',
  88.  
  89. )
  90. );
  91.  
  92. $wp_customize->add_control(
  93. 'rambo_pro_theme_options[slideshowSpeed]',
  94. array(
  95. 'type' => 'select',
  96. 'label' => __('Animation speed','rambo'),
  97. 'section' => 'slider_section_settings',
  98. 'priority' => 300,
  99. 'choices' => array('500'=>'0.5','1000'=>'1.0','1500'=>'1.5','2000' => '2.0','2500' => '2.5' ,'3000' =>'3.0' , '3500' => '3.5', '4000' => '4.0','4500' => '4.5' ,'5000' => '5.0' , '5500' => '5.5' )));
  100.  
  101. // Slide show speed
  102. $wp_customize->add_setting(
  103. 'rambo_pro_theme_options[slideshowSpeed]',
  104. array(
  105. 'default' => __('2500','rambo'),
  106. 'type' => 'option',
  107. 'sanitize_callback' => 'sanitize_text_field',
  108.  
  109. )
  110. );
  111.  
  112. $wp_customize->add_control(
  113. 'rambo_pro_theme_options[slideshowSpeed]',
  114. array(
  115. 'type' => 'select',
  116. 'label' => __('Slideshow speed','rambo'),
  117. 'section' => 'slider_section_settings',
  118. 'priority' => 300,
  119. 'choices' => array('500'=>'0.5','1000'=>'1.0','1500'=>'1.5','2000' => '2.0','2500' => '2.5' ,'3000' =>'3.0' , '3500' => '3.5', '4000' => '4.0','4500' => '4.5' ,'5000' => '5.0' , '5500' => '5.5' )));
  120.  
  121. //Add Slider setting
  122. class WP_slider_Customize_Control extends WP_Customize_Control {
  123. public $type = 'new_menu';
  124. /**
  125. * Render the control's content.
  126. */
  127. public function render_content() {
  128. ?>
  129. <a href="<?php bloginfo ( 'url' );?>/wp-admin/post-new.php?post_type=rambopro_slider" class="button" target="_blank"><?php _e( 'Click Here To Add Slider', 'rambo' ); ?></a>
  130. <?php
  131. }
  132. }
  133.  
  134. $wp_customize->add_setting(
  135. 'slider',
  136. array(
  137. 'default' => __('','rambo'),
  138. 'capability' => 'edit_theme_options',
  139. 'sanitize_callback' => 'sanitize_text_field',
  140. )
  141. );
  142. $wp_customize->add_control( new WP_slider_Customize_Control( $wp_customize, 'slider', array(
  143. 'section' => 'slider_section_settings',
  144. 'priority' => 500,
  145. ))
  146. );
  147.  
  148. $wp_customize->add_section( 'site_intro' , array(
  149. 'title' => __('Site Intro ', 'rambo'),
  150. 'panel' => 'home_page_setting',
  151. ) );
  152.  
  153. $wp_customize->add_setting(
  154. 'rambo_pro_theme_options[site_intro_descritpion]',
  155. array(
  156. 'default' => __('Rambo is a clean and fully responsive Template.','rambo'),
  157. 'capability' => 'edit_theme_options',
  158. 'sanitize_callback' => 'sanitize_text_field',
  159. 'type' => 'option'
  160. )
  161. );
  162. $wp_customize->add_control(
  163. 'rambo_pro_theme_options[site_intro_descritpion]',
  164. array(
  165. 'label' => __('Intro description','rambo'),
  166. 'section' => 'site_intro',
  167. 'type' => 'textarea',
  168. )
  169. );
  170.  
  171. //Site intro call now
  172. $wp_customize->add_setting(
  173. 'rambo_pro_theme_options[site_intro_button_text]',
  174. array(
  175. 'default' => __('Purchase Now','rambo'),
  176. 'capability' => 'edit_theme_options',
  177. 'sanitize_callback' => 'sanitize_text_field',
  178. 'type' => 'option'
  179. )
  180. );
  181. $wp_customize->add_control(
  182. 'rambo_pro_theme_options[site_intro_button_text]',
  183. array(
  184. 'label' => __('Intro button text','rambo'),
  185. 'section' => 'site_intro',
  186. 'type' => 'text',
  187. )
  188. );
  189.  
  190. //Button Link
  191. $wp_customize ->add_setting (
  192. 'rambo_pro_theme_options[site_intro_button_link]',
  193. array(
  194. 'default' => __('#','rambo'),
  195. 'capability' => 'edit_theme_options',
  196. 'sanitize_callback' => 'sanitize_text_field',
  197. 'type' => 'option',
  198. ) );
  199.  
  200. $wp_customize->add_control (
  201. 'rambo_pro_theme_options[site_intro_button_link]',
  202. array (
  203. 'label' => __('Intro button link','rambo'),
  204. 'section' => 'site_intro',
  205. 'type' => 'text',
  206. ) );
  207.  
  208. $wp_customize->add_setting(
  209. 'rambo_pro_theme_options[intro_button_target]',
  210. array('capability' => 'edit_theme_options',
  211. 'sanitize_callback' => 'sanitize_text_field',
  212. 'type' => 'option',
  213. ));
  214.  
  215. $wp_customize->add_control(
  216. 'rambo_pro_theme_options[intro_button_target]',
  217. array(
  218. 'type' => 'checkbox',
  219. 'label' => __('Open link new tab/window','rambo'),
  220. 'section' => 'site_intro',
  221. )
  222. );
  223. //Service
  224. $wp_customize->add_section( 'service_section_head' , array(
  225. 'title' => __('Service Setting ', 'rambo'),
  226. 'panel' => 'home_page_setting',
  227. ) );
  228.  
  229.  
  230. //Number of services
  231.  
  232. $wp_customize->add_setting(
  233. 'rambo_pro_theme_options[service_list]',
  234. array(
  235. 'default' => 4,
  236. 'type' => 'option',
  237. 'sanitize_callback' => 'sanitize_text_field',
  238.  
  239. )
  240. );
  241.  
  242. $wp_customize->add_control(
  243. 'rambo_pro_theme_options[service_list]',
  244. array(
  245. 'type' => 'select',
  246. 'label' => __('Enabled Number of services on Home Page(service section)','rambo'),
  247. 'section' => 'service_section_head',
  248. 'choices' => array(4=>4,8=>8,12=>12,16=>16,20=>20,24=>24),
  249. ));
  250.  
  251.  
  252. $wp_customize->add_setting(
  253. 'rambo_pro_theme_options[service_section_title]',
  254. array(
  255. 'default' => __('Our Services','rambo'),
  256. 'capability' => 'edit_theme_options',
  257. 'sanitize_callback' => 'sanitize_text_field',
  258. 'type' => 'option'
  259. )
  260. );
  261. $wp_customize->add_control(
  262. 'rambo_pro_theme_options[service_section_title]',
  263. array(
  264. 'label' => __('Service Title','rambo'),
  265. 'section' => 'service_section_head',
  266. 'type' => 'text',
  267. )
  268. );
  269.  
  270. $wp_customize->add_setting(
  271. 'rambo_pro_theme_options[service_section_descritpion]',
  272. array(
  273. 'default' => __('Check out our Main Services which we offer to every client','rambo'),
  274. 'sanitize_callback' => 'sanitize_text_field',
  275. 'type' => 'option'
  276. )
  277. );
  278. $wp_customize->add_control(
  279. 'rambo_pro_theme_options[service_section_descritpion]',
  280. array(
  281. 'label' => __('Service Description','rambo'),
  282. 'section' => 'service_section_head',
  283. 'type' => 'textarea',
  284. 'sanitize_callback' => 'sanitize_text_field',
  285. )
  286. );
  287.  
  288. //Add Service setting
  289. class WP_service_Customize_Control extends WP_Customize_Control {
  290. public $type = 'new_menu';
  291. /**
  292. * Render the control's content.
  293. */
  294. public function render_content() {
  295. ?>
  296. <a href="<?php bloginfo ( 'url' );?>/wp-admin/edit.php?post_type=rambopro_service" class="button" target="_blank"><?php _e( 'Click Here To Add Service', 'rambo' ); ?></a>
  297. <?php
  298. }
  299. }
  300.  
  301. $wp_customize->add_setting(
  302. 'service_front',
  303. array(
  304. 'default' => __('','rambo'),
  305. 'capability' => 'edit_theme_options',
  306. 'sanitize_callback' => 'sanitize_text_field',
  307. )
  308. );
  309. $wp_customize->add_control( new WP_service_Customize_Control( $wp_customize, 'service_front', array(
  310. 'section' => 'service_section_head',
  311. 'priority' => 500,
  312. ))
  313. );
  314.  
  315.  
  316. //Portfolio setting
  317. $wp_customize->add_section(
  318. 'project_section_settings',
  319. array(
  320. 'title' => __('Project Setting','rambo'),
  321. 'description' => '',
  322. 'panel' => 'home_page_setting',)
  323. );
  324.  
  325.  
  326. // Number of Portfolio section
  327. $wp_customize->add_setting(
  328. 'rambo_pro_theme_options[project_list]',
  329. array(
  330. 'capability' => 'edit_theme_options',
  331. 'sanitize_callback' => 'sanitize_text_field',
  332. 'type' => 'option',
  333. )
  334. );
  335. $wp_customize->add_control( 'rambo_pro_theme_options[project_list]',array(
  336. 'type' => 'select',
  337. 'label' => __('Number of Portfolio on Portfolio section','rambo'),
  338. 'section' => 'project_section_settings',
  339. 'choices' => array(4=>4,8=>8,12=>12,16=>16,20=>20,24=>24),
  340. )
  341. );
  342.  
  343. //Project Title
  344. $wp_customize->add_setting(
  345. 'rambo_pro_theme_options[project_protfolio_tag_line]',
  346. array(
  347. 'default' => __('Featured Portfolio Project','rambo'),
  348. 'capability' => 'edit_theme_options',
  349. 'sanitize_callback' => 'sanitize_text_field',
  350. 'type' => 'option',
  351. )
  352. );
  353. $wp_customize->add_control('rambo_pro_theme_options[project_protfolio_tag_line]',array(
  354. 'label' => __('Project title','rambo'),
  355. 'section' => 'project_section_settings',
  356. 'type' => 'text',) );
  357.  
  358. //Project Description
  359. $wp_customize->add_setting(
  360. 'rambo_pro_theme_options[project_protfolio_description_tag]',
  361. array(
  362. 'default' => __('Lorem ipsum dolor sit amet, consectetuer adipiscing elit lorem ipsum dolor sit amet','rambo'),
  363. 'capability' => 'edit_theme_options',
  364. 'sanitize_callback' => 'sanitize_text_field',
  365. 'type' => 'option',
  366. )
  367. );
  368. $wp_customize->add_control( 'rambo_pro_theme_options[project_protfolio_description_tag]',array(
  369. 'label' => __('Project Description','rambo'),
  370. 'section' => 'project_section_settings',
  371. 'type' => 'textarea',) );
  372.  
  373. $wp_customize->add_setting(
  374. 'rambo_pro_theme_options[taxonomy_portfolio_list]',
  375. array(
  376. 'default' => 2,
  377. 'capability' => 'edit_theme_options',
  378. 'sanitize_callback' => 'sanitize_text_field',
  379. 'type' => 'option',
  380. )
  381. );
  382. $wp_customize->add_control( 'rambo_pro_theme_options[taxonomy_portfolio_list]',array(
  383. 'type' => 'select',
  384. 'label' => __('Select Portfolio category archive column layout','rambo'),
  385. 'section' => 'project_section_settings',
  386. 'choices' => array(2=>2,3=>3,4=>4),
  387. )
  388. );
  389.  
  390. //link
  391. class WP_project_Customize_Control extends WP_Customize_Control {
  392. public $type = 'new_menu';
  393. /**
  394. * Render the control's content.
  395. */
  396. public function render_content() {
  397. ?>
  398. <a href="<?php bloginfo ( 'url' );?>/wp-admin/edit.php?post_type=rambopro_project" class="button" target="_blank"><?php _e( 'Click Here To add Project', 'rambo' ); ?></a>
  399. <?php
  400. }
  401. }
  402.  
  403. $wp_customize->add_setting(
  404. 'project',
  405. array(
  406. 'default' => __('','rambo'),
  407. 'capability' => 'edit_theme_options',
  408. 'sanitize_callback' => 'sanitize_text_field',
  409. )
  410. );
  411. $wp_customize->add_control( new WP_project_Customize_Control( $wp_customize, 'project', array(
  412. 'section' => 'project_section_settings',
  413. ))
  414. );
  415.  
  416. //Recent News setting
  417. $wp_customize->add_section(
  418. 'recent_news_settings',
  419. array(
  420. 'title' => __('Recent News Setting','rambo'),
  421. 'description' => '',
  422. 'panel' => 'home_page_setting',)
  423. );
  424.  
  425. $wp_customize->add_setting(
  426. 'rambo_pro_theme_options[home_latest_news_enabled]',
  427. array(
  428. 'default' => true,
  429. 'capability' => 'edit_theme_options',
  430. 'sanitize_callback' => 'sanitize_text_field',
  431. 'type' => 'option',
  432. )
  433. );
  434. $wp_customize->add_control(
  435. 'rambo_pro_theme_options[home_latest_news_enabled]',
  436. array(
  437. 'label' => __('Enable Latest News Section','rambo'),
  438. 'section' => 'recent_news_settings',
  439. 'type' => 'checkbox',
  440. ));
  441. // //News Title
  442. $wp_customize->add_setting(
  443. 'rambo_pro_theme_options[blog_section_head]',
  444. array(
  445. 'default' => __('Recent News','rambo'),
  446. 'capability' => 'edit_theme_options',
  447. 'sanitize_callback' => 'sanitize_text_field',
  448. 'type' => 'option',
  449. )
  450. );
  451. $wp_customize->add_control('rambo_pro_theme_options[blog_section_head]',array(
  452. 'label' => __('Recent News Section Heading','rambo'),
  453. 'section' => 'recent_news_settings',
  454. 'type' => 'text',) );
  455.  
  456.  
  457. //Select number of latest news on front page
  458.  
  459. $wp_customize->add_setting(
  460. 'rambo_pro_theme_options[post_display_count]',
  461. array(
  462. 'type' => 'option',
  463. 'default' => __('3','rambo'),
  464. 'sanitize_callback' => 'sanitize_text_field',
  465. )
  466. );
  467.  
  468. $wp_customize->add_control(
  469. 'rambo_pro_theme_options[post_display_count]',
  470. array(
  471. 'type' => 'select',
  472. 'label' => __('Select Number of Post','rambo'),
  473. 'section' => 'recent_news_settings',
  474. 'choices' => array('1'=>__('1', 'rambo'), '2'=>__('2', 'rambo'), '3' => __('3','rambo'), '4' => __('4','rambo'),'5'=> __('5','rambo'), '6'=> __('6','rambo'),'7'=> __('7','rambo'), '8' =>__('8','rambo'), '9' =>__('9','rambo'), '10' =>__('10','rambo'), '11' =>__('11','rambo'), '12' =>__('12','rambo'), '13' =>__('13','rambo'), '14' =>__('14','rambo'), '15' =>__('15','rambo')),
  475. ));
  476.  
  477.  
  478.  
  479. //Footer call-out setting
  480. $wp_customize->add_section(
  481. 'footer_callout_setting',
  482. array(
  483. 'title' => __('Footer Call Out Area Setting','rambo'),
  484. 'description' => '',
  485. 'panel' => 'home_page_setting',)
  486. );
  487.  
  488. //Footer callout text
  489.  
  490.  
  491. //Site intro
  492.  
  493. $wp_customize->add_setting(
  494. 'rambo_pro_theme_options[site_info_enabled]',
  495. array(
  496. 'default' => true,
  497. 'capability' => 'edit_theme_options',
  498. 'sanitize_callback' => 'sanitize_text_field',
  499. 'type' => 'option',
  500. )
  501. );
  502. $wp_customize->add_control(
  503. 'rambo_pro_theme_options[site_info_enabled]',
  504. array(
  505. 'label' => __('Enable Site Intro','rambo'),
  506. 'section' => 'footer_callout_setting',
  507. 'type' => 'checkbox',
  508. ));
  509.  
  510. $wp_customize ->add_setting (
  511. 'rambo_pro_theme_options[site_info_title]',
  512. array(
  513. 'default' => __('Rambo is a clean and fully responsive Template.','rambo'),
  514. 'capability' => 'edit_theme_options',
  515. 'sanitize_callback' => 'sanitize_text_field',
  516. 'type' => 'option',
  517. )
  518. );
  519.  
  520. $wp_customize->add_control (
  521. 'rambo_pro_theme_options[site_info_title]',
  522. array (
  523. 'label' => __('Footer call out title','rambo'),
  524. 'section' => 'footer_callout_setting',
  525. 'type' => 'text',
  526. ) );
  527.  
  528. $wp_customize ->add_setting (
  529. 'rambo_pro_theme_options[site_info_descritpion]',
  530. array(
  531. 'default' => __('At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos excepturi vehicula sem ut volutpat. Ut non libero magna fusce condimentum eleifend enim a feugiat.','rambo'),
  532. 'capability' => 'edit_theme_options',
  533. 'sanitize_callback' => 'sanitize_text_field',
  534. 'type' => 'option',
  535. )
  536. );
  537.  
  538. $wp_customize->add_control (
  539. 'rambo_pro_theme_options[site_info_descritpion]',
  540. array (
  541. 'label' => __('Footer call out description','rambo'),
  542. 'section' => 'footer_callout_setting',
  543. 'type' => 'textarea',
  544. ) );
  545.  
  546. $wp_customize ->add_setting (
  547. 'rambo_pro_theme_options[site_info_button_text]',
  548. array(
  549. 'default' => __('Purchase Now','rambo'),
  550. 'capability' => 'edit_theme_options',
  551. 'sanitize_callback' => 'sanitize_text_field',
  552. 'type' => 'option',
  553. )
  554. );
  555.  
  556. $wp_customize->add_control (
  557. 'rambo_pro_theme_options[site_info_button_text]',
  558. array (
  559. 'label' => __('Footer call out button text ','rambo'),
  560. 'section' => 'footer_callout_setting',
  561. 'type' => 'text',
  562. ) );
  563.  
  564.  
  565.  
  566. $wp_customize ->add_setting (
  567. 'rambo_pro_theme_options[site_info_button_link]',
  568. array(
  569. 'default' => __('#','rambo'),
  570. 'capability' => 'edit_theme_options',
  571. 'sanitize_callback' => 'sanitize_text_field',
  572. 'type' => 'option',
  573. ) );
  574.  
  575. $wp_customize->add_control (
  576. 'rambo_pro_theme_options[site_info_button_link]',
  577. array (
  578. 'label' => __('Call Out Button Link','rambo'),
  579. 'section' => 'footer_callout_setting',
  580. 'type' => 'text',
  581. ) );
  582.  
  583. $wp_customize->add_setting(
  584. 'rambo_pro_theme_options[site_info_button_link_target]',
  585. array('capability' => 'edit_theme_options',
  586. 'sanitize_callback' => 'sanitize_text_field',
  587. 'type' => 'option',
  588. 'default' => true,
  589. ));
  590.  
  591. $wp_customize->add_control(
  592. 'rambo_pro_theme_options[site_info_button_link_target]',
  593. array(
  594. 'type' => 'checkbox',
  595. 'label' => __('Open link new tab/window','rambo'),
  596. 'section' => 'footer_callout_setting',
  597. )
  598. );
  599.  
  600. $wp_customize->add_section(
  601. 'footer_copyright_setting',
  602. array(
  603. 'title' => __('Footer Copyright Custmization ','rambo'),
  604. 'description' => '',
  605. 'panel' => 'home_page_setting',)
  606. );
  607.  
  608. $wp_customize->add_setting(
  609. 'rambo_pro_theme_options[footer_copyright]',
  610. array(
  611. 'default' => __('Copyright @ 2014 - RAMBO. Designed by <a href="http://webriti.com" rel="nofollow" target="_blank">Webriti</a>','rambo'),
  612. 'type' =>'option'
  613. ));
  614. $wp_customize->add_control(
  615. 'rambo_pro_theme_options[footer_copyright]',
  616. array(
  617. 'label' => __('Footer Customization text','rambo'),
  618. 'section' => 'footer_copyright_setting',
  619. 'type' => 'textarea',
  620. ));
  621. }
  622. add_action( 'customize_register', 'rambo_home_page_customizer' );
  623. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement