Guest User

Untitled

a guest
Nov 24th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. <?php
  2. function wallstreet_project_customizer( $wp_customize ) {
  3.  
  4. //Home project Section
  5. $wp_customize->add_panel( 'wallstreet_project_setting', array(
  6. 'priority' => 700,
  7. 'capability' => 'edit_theme_options',
  8. 'title' => __('Project settings', 'wallstreet'),
  9. ) );
  10.  
  11. $wp_customize->add_section(
  12. 'project_section_settings',
  13. array(
  14. 'title' => __('Homepage project settings','wallstreet'),
  15. 'description' => '',
  16. 'panel' => 'wallstreet_project_setting',)
  17. );
  18.  
  19.  
  20. // Number of Portfolio section
  21. $wp_customize->add_setting(
  22. 'wallstreet_pro_options[portfolio_list]',
  23. array(
  24. 'default' => 4,
  25. 'capability' => 'edit_theme_options',
  26. 'sanitize_callback' => '',
  27. 'type' => 'option',
  28. )
  29. );
  30. $wp_customize->add_control( 'wallstreet_pro_options[portfolio_list]',array(
  31. 'type' => 'select',
  32. 'label' => __('Number of portfolio on portfolio section','wallstreet'),
  33. 'section' => 'project_section_settings',
  34. 'choices' => array(4=>4,8=>8,12=>12,16=>16,20=>20,24=>24),
  35. )
  36. );
  37.  
  38. // //Project Title
  39. $wp_customize->add_setting(
  40. 'wallstreet_pro_options[portfolio_title]',
  41. array(
  42. 'default' => __('Featured portfolio project','wallstreet'),
  43. 'capability' => 'edit_theme_options',
  44. 'sanitize_callback' => '',
  45. 'type' => 'option',
  46. )
  47. );
  48. $wp_customize->add_control('wallstreet_pro_options[portfolio_title]',array(
  49. 'label' => __('Title','wallstreet'),
  50. 'section' => 'project_section_settings',
  51. 'type' => 'text',) );
  52.  
  53. //Project Description
  54. $wp_customize->add_setting(
  55. 'wallstreet_pro_options[portfolio_description]',
  56. array(
  57. 'default' => __('Most popular of our works.','wallstreet'),
  58. 'capability' => 'edit_theme_options',
  59. 'sanitize_callback' => '',
  60. 'type' => 'option',
  61. )
  62. );
  63. $wp_customize->add_control( 'wallstreet_pro_options[portfolio_description]',array(
  64. 'label' => __('Description','wallstreet'),
  65. 'section' => 'project_section_settings',
  66. 'type' => 'text',) );
  67.  
  68. //View all portfolio Button Link
  69. $wp_customize->add_setting(
  70. 'wallstreet_pro_options[view_all_projects_btn_enabled]',
  71. array(
  72. 'default' => true,
  73. 'capability' => 'edit_theme_options',
  74. 'sanitize_callback' => '',
  75. 'type' => 'option',
  76. ));
  77.  
  78. $wp_customize->add_control( 'wallstreet_pro_options[view_all_projects_btn_enabled]',array(
  79. 'label' => __('Enable view all portfolios button','wallstreet'),
  80. 'section' => 'project_section_settings',
  81. 'type' => 'checkbox',) );
  82.  
  83.  
  84. //Project Project Button text
  85. $wp_customize->add_setting(
  86. 'wallstreet_pro_options[portfolio_more_text]',
  87. array(
  88. 'default' => __('View All Projects','wallstreet'),
  89. 'capability' => 'edit_theme_options',
  90. 'sanitize_callback' => '',
  91. 'type' => 'option',
  92. )
  93. );
  94. $wp_customize->add_control( 'wallstreet_pro_options[portfolio_more_text]',array(
  95. 'label' => __('Button Text','wallstreet'),
  96. 'section' => 'project_section_settings',
  97. 'type' => 'text',) );
  98.  
  99. //View all portfolio Button Link
  100. $wp_customize->add_setting(
  101. 'wallstreet_pro_options[portfolio_more_link]',
  102. array(
  103. 'default' =>'#',
  104. 'capability' => 'edit_theme_options',
  105. 'sanitize_callback' => '',
  106. 'type' => 'option',
  107. ));
  108.  
  109. $wp_customize->add_control( 'wallstreet_pro_options[portfolio_more_link]',array(
  110. 'label' => __('Button Link','wallstreet'),
  111. 'section' => 'project_section_settings',
  112. 'type' => 'text',) );
  113.  
  114. //View all portfolio Button Link
  115. $wp_customize->add_setting(
  116. 'wallstreet_pro_options[portfolio_more_lnik_target]',
  117. array(
  118. 'default' => false,
  119. 'capability' => 'edit_theme_options',
  120. 'sanitize_callback' => '',
  121. 'type' => 'option',
  122. 'description' => 'Open link in a new window/tab',
  123. ));
  124.  
  125. $wp_customize->add_control( 'wallstreet_pro_options[portfolio_more_lnik_target]',array(
  126. 'label' => __('Open link in new tab','wallstreet'),
  127. 'section' => 'project_section_settings',
  128. 'type' => 'checkbox',) );
  129.  
  130.  
  131. //link
  132. class WP_project_Customize_Control extends WP_Customize_Control {
  133. public $type = 'new_menu';
  134. /**
  135. * Render the control's content.
  136. */
  137. public function render_content() {
  138. ?>
  139. <a href="<?php bloginfo ( 'url' );?>/wp-admin/edit.php?post_type=wallstreet_portfolio" class="button" target="_blank"><?php _e( 'Click here to add project', 'wallstreet' ); ?></a>
  140. <?php
  141. }
  142. }
  143.  
  144. $wp_customize->add_setting(
  145. 'project',
  146. array(
  147. 'default' => '',
  148. 'capability' => 'edit_theme_options',
  149. 'sanitize_callback' => '',
  150. )
  151. );
  152. $wp_customize->add_control( new WP_project_Customize_Control( $wp_customize, 'project', array(
  153. 'section' => 'project_section_settings',
  154. ))
  155. );
  156.  
  157.  
  158.  
  159. }
  160. add_action( 'customize_register', 'wallstreet_project_customizer' );
  161. ?>
Add Comment
Please, Sign In to add comment