Tan-007 /
DesignFly
| 1 | <?php |
||||||||
| 2 | /** |
||||||||
| 3 | * DesignFly Theme Customizer |
||||||||
| 4 | * |
||||||||
| 5 | * @package DesignFly |
||||||||
| 6 | */ |
||||||||
| 7 | |||||||||
| 8 | /** |
||||||||
| 9 | * Add postMessage support for site title and description for the Theme Customizer. |
||||||||
| 10 | * |
||||||||
| 11 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 12 | */ |
||||||||
| 13 | function designfly_customize_register( $wp_customize ) { |
||||||||
| 14 | $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
||||||||
| 15 | $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
||||||||
| 16 | $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
||||||||
| 17 | |||||||||
| 18 | if ( isset( $wp_customize->selective_refresh ) ) { |
||||||||
| 19 | $wp_customize->selective_refresh->add_partial( 'blogname', array( |
||||||||
| 20 | 'selector' => '.site-title a', |
||||||||
| 21 | 'render_callback' => 'designfly_customize_partial_blogname', |
||||||||
| 22 | ) ); |
||||||||
| 23 | $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
||||||||
| 24 | 'selector' => '.site-description', |
||||||||
| 25 | 'render_callback' => 'designfly_customize_partial_blogdescription', |
||||||||
| 26 | ) ); |
||||||||
| 27 | } |
||||||||
| 28 | } |
||||||||
| 29 | add_action( 'customize_register', 'designfly_customize_register' ); |
||||||||
|
0 ignored issues
–
show
The function
add_action was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 30 | |||||||||
| 31 | /** |
||||||||
| 32 | * Render the site title for the selective refresh partial. |
||||||||
| 33 | * |
||||||||
| 34 | * @return void |
||||||||
| 35 | */ |
||||||||
| 36 | function designfly_customize_partial_blogname() { |
||||||||
| 37 | bloginfo( 'name' ); |
||||||||
|
0 ignored issues
–
show
The function
bloginfo was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 38 | } |
||||||||
| 39 | |||||||||
| 40 | /** |
||||||||
| 41 | * Render the site tagline for the selective refresh partial. |
||||||||
| 42 | * |
||||||||
| 43 | * @return void |
||||||||
| 44 | */ |
||||||||
| 45 | function designfly_customize_partial_blogdescription() { |
||||||||
| 46 | bloginfo( 'description' ); |
||||||||
|
0 ignored issues
–
show
The function
bloginfo was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 47 | } |
||||||||
| 48 | |||||||||
| 49 | /** |
||||||||
| 50 | * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. |
||||||||
| 51 | */ |
||||||||
| 52 | function designfly_customize_preview_js() { |
||||||||
| 53 | wp_enqueue_script( 'designfly-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); |
||||||||
|
0 ignored issues
–
show
The function
get_template_directory_uri was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The function
wp_enqueue_script was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 54 | } |
||||||||
| 55 | add_action( 'customize_preview_init', 'designfly_customize_preview_js' ); |
||||||||
| 56 | |||||||||
| 57 | |||||||||
| 58 | /** |
||||||||
| 59 | * function for registering all theme mods on 'Home Page' |
||||||||
| 60 | * |
||||||||
| 61 | * @since 1.0.5 |
||||||||
| 62 | */ |
||||||||
| 63 | |||||||||
| 64 | function register_home_mods( $wp_customize ) { |
||||||||
| 65 | /* Home Page Settings */ |
||||||||
| 66 | // 'Home Page' display header section or not |
||||||||
| 67 | $wp_customize -> add_setting( 'designfly-home-display-header', array( |
||||||||
| 68 | 'default' => true, |
||||||||
| 69 | ) ); |
||||||||
| 70 | |||||||||
| 71 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-home-display-header-control', |
||||||||
|
0 ignored issues
–
show
The type
WP_Customize_Control was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||||
| 72 | array( |
||||||||
| 73 | 'label' => __( 'Display header section', 'designfly' ), |
||||||||
|
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 74 | 'section' => 'static_front_page', |
||||||||
| 75 | 'settings' => 'designfly-home-display-header', |
||||||||
| 76 | 'type' => 'checkbox', |
||||||||
| 77 | 'priority' => 1, |
||||||||
| 78 | ) ) ); |
||||||||
| 79 | |||||||||
| 80 | // 'Home page' display recent portfolio |
||||||||
| 81 | $wp_customize -> add_setting( 'designfly-home-display-portfolio', array( |
||||||||
| 82 | 'default' => true, |
||||||||
| 83 | ) ); |
||||||||
| 84 | |||||||||
| 85 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-home-display-portfolio-control', |
||||||||
| 86 | array( |
||||||||
| 87 | 'label' => __( 'Display latest portfolio items', 'designfly' ), |
||||||||
| 88 | 'section' => 'static_front_page', |
||||||||
| 89 | 'settings' => 'designfly-home-display-portfolio', |
||||||||
| 90 | 'type' => 'checkbox', |
||||||||
| 91 | 'priority' => 2, |
||||||||
| 92 | ) ) ); |
||||||||
| 93 | |||||||||
| 94 | // 'Home Page' portfolio section title |
||||||||
| 95 | $wp_customize -> add_setting( 'designfly-home-portfolio-title', array( |
||||||||
| 96 | 'default' => 'D\'sign is the soul' |
||||||||
| 97 | ) ); |
||||||||
| 98 | |||||||||
| 99 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-home-portfolio-title-control', |
||||||||
| 100 | array( |
||||||||
| 101 | 'label' => __( 'Portfolio Section Title', 'designfly' ), |
||||||||
| 102 | 'section' => 'static_front_page', |
||||||||
| 103 | 'settings' => 'designfly-home-portfolio-title', |
||||||||
| 104 | 'type' => 'text', |
||||||||
| 105 | 'priority' => 3, |
||||||||
| 106 | ) ) ); |
||||||||
| 107 | |||||||||
| 108 | // 'Home Page' View all button url |
||||||||
| 109 | $wp_customize -> add_setting( 'designfly-home-portfolio-btn', array( |
||||||||
| 110 | 'default' => '', |
||||||||
| 111 | ) ); |
||||||||
| 112 | |||||||||
| 113 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-hoome-portfolio-btn-control', |
||||||||
| 114 | array( |
||||||||
| 115 | 'label' => __( 'Portfolio \'View all\' button url', 'designfly' ), |
||||||||
| 116 | 'section' => 'static_front_page', |
||||||||
| 117 | 'settings' => 'designfly-home-portfolio-btn', |
||||||||
| 118 | 'type' => 'dropdown-pages', |
||||||||
| 119 | 'priority' => 4, |
||||||||
| 120 | ) ) ); |
||||||||
| 121 | |||||||||
| 122 | } |
||||||||
| 123 | |||||||||
| 124 | /** |
||||||||
| 125 | * function for registering 'Footer section' theme mods |
||||||||
| 126 | * |
||||||||
| 127 | * @since 1.0.5 |
||||||||
| 128 | */ |
||||||||
| 129 | function register_footer_mods( $wp_customize ) { |
||||||||
| 130 | $wp_customize -> add_section( 'designfly-footer-section', array( |
||||||||
| 131 | 'title' => __( 'Footer settings', 'designfly' ) |
||||||||
|
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 132 | ) ); |
||||||||
| 133 | |||||||||
| 134 | // contact info |
||||||||
| 135 | $wp_customize -> add_setting( 'designfly-footer-contact', array( |
||||||||
| 136 | 'capability' => 'edit_theme_options', |
||||||||
| 137 | 'default' => 'Street 21 Planet, A-11, california <br> Tel: 91234 42354' |
||||||||
| 138 | ) ); |
||||||||
| 139 | |||||||||
| 140 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-footer-contact-control', |
||||||||
| 141 | array( |
||||||||
| 142 | 'label' => __( 'Contact info(use \'<br>\' for new line)', 'designfly' ), |
||||||||
| 143 | 'section' => 'designfly-footer-section', |
||||||||
| 144 | 'settings' => 'designfly-footer-contact', |
||||||||
| 145 | 'type' => 'textarea', |
||||||||
| 146 | ) ) ); |
||||||||
| 147 | |||||||||
| 148 | |||||||||
| 149 | $wp_customize -> add_setting( 'designfly-footer-email', array( |
||||||||
| 150 | 'capability' => 'edit_theme_options', |
||||||||
| 151 | 'default' => '' |
||||||||
| 152 | ) ); |
||||||||
| 153 | |||||||||
| 154 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-footer-email-control', |
||||||||
| 155 | array( |
||||||||
| 156 | 'label' => __( 'Contact email', 'designfly' ), |
||||||||
| 157 | 'section' => 'designfly-footer-section', |
||||||||
| 158 | 'settings' => 'designfly-footer-email', |
||||||||
| 159 | 'type' => 'text', |
||||||||
| 160 | ) ) ); |
||||||||
| 161 | |||||||||
| 162 | |||||||||
| 163 | // Site info text |
||||||||
| 164 | $wp_customize -> add_setting( 'designfly-footer-info', array( |
||||||||
| 165 | 'capability' => 'edit_theme_options', |
||||||||
| 166 | 'default' => '2012 - DESIGNfly' |
||||||||
| 167 | ) ); |
||||||||
| 168 | |||||||||
| 169 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-footer-info-control', |
||||||||
| 170 | array( |
||||||||
| 171 | 'label' => __( 'Site info text', 'designfly' ), |
||||||||
| 172 | 'section' => 'designfly-footer-section', |
||||||||
| 173 | 'settings' => 'designfly-footer-info', |
||||||||
| 174 | 'type' => 'text', |
||||||||
| 175 | ) ) ); |
||||||||
| 176 | |||||||||
| 177 | // Social media urls |
||||||||
| 178 | $wp_customize -> add_setting( 'designfly-footer-urls', array( |
||||||||
| 179 | 'capability' => 'edit_theme_options', |
||||||||
| 180 | 'default' => 'https://www.facebook.com/' |
||||||||
| 181 | ) ); |
||||||||
| 182 | |||||||||
| 183 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-footer-urls-control', |
||||||||
| 184 | array( |
||||||||
| 185 | 'label' => __( 'Social site urls(separate urls with a semicolon(;))', 'designfly' ), |
||||||||
| 186 | 'section' => 'designfly-footer-section', |
||||||||
| 187 | 'settings' => 'designfly-footer-urls', |
||||||||
| 188 | 'type' => 'textarea', |
||||||||
| 189 | ) ) ); |
||||||||
| 190 | |||||||||
| 191 | } |
||||||||
| 192 | |||||||||
| 193 | /** |
||||||||
| 194 | * function for making the 'features' section customizable from admin panel |
||||||||
| 195 | * @since 1.0.2 |
||||||||
| 196 | */ |
||||||||
| 197 | |||||||||
| 198 | function register_features_mods( $wp_customize ) { |
||||||||
| 199 | $wp_customize -> add_section( 'designfly-features-section', array( |
||||||||
| 200 | 'title' => __( 'Services bar', 'designfly' ) |
||||||||
|
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 201 | ) ); |
||||||||
| 202 | |||||||||
| 203 | /* Features settings */ |
||||||||
| 204 | // 'Features' display or not |
||||||||
| 205 | $wp_customize -> add_setting( 'designfly-features-display', array( |
||||||||
| 206 | 'default' => true, |
||||||||
| 207 | ) ); |
||||||||
| 208 | |||||||||
| 209 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-features-display-control', |
||||||||
| 210 | array( |
||||||||
| 211 | 'label' => __( 'Display features?', 'designfly' ), |
||||||||
| 212 | 'section' => 'designfly-features-section', |
||||||||
| 213 | 'settings' => 'designfly-features-display', |
||||||||
| 214 | 'type' => 'checkbox', |
||||||||
| 215 | ) ) ); |
||||||||
| 216 | /* Features block-1 */ |
||||||||
| 217 | // 'Features' title |
||||||||
| 218 | $wp_customize -> add_setting( 'designfly-features-title-1', array( |
||||||||
| 219 | 'default' => 'Title Text' |
||||||||
| 220 | ) ); |
||||||||
| 221 | |||||||||
| 222 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-features-title-control-1', |
||||||||
| 223 | array( |
||||||||
| 224 | 'label' => __( 'Title-1', 'designfly' ), |
||||||||
| 225 | 'section' => 'designfly-features-section', |
||||||||
| 226 | 'settings' => 'designfly-features-title-1', |
||||||||
| 227 | ) ) ); |
||||||||
| 228 | |||||||||
| 229 | // 'Features' paragraph |
||||||||
| 230 | $wp_customize -> add_setting( 'designfly-features-para-1', array( |
||||||||
| 231 | 'default' => 'Description about the service...' |
||||||||
| 232 | ) ); |
||||||||
| 233 | |||||||||
| 234 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-features-para-control-1', |
||||||||
| 235 | array( |
||||||||
| 236 | 'label' => __( 'Description-1', 'designfly' ), |
||||||||
| 237 | 'section' => 'designfly-features-section', |
||||||||
| 238 | 'settings' => 'designfly-features-para-1', |
||||||||
| 239 | 'type' => 'textarea', |
||||||||
| 240 | ) ) ); |
||||||||
| 241 | |||||||||
| 242 | // 'Features' Image |
||||||||
| 243 | $wp_customize -> add_setting( 'designfly-features-image-1' ); |
||||||||
| 244 | |||||||||
| 245 | $wp_customize -> add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'designfly-features-image-control-1', |
||||||||
|
0 ignored issues
–
show
The type
WP_Customize_Cropped_Image_Control was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||||
| 246 | array( |
||||||||
| 247 | 'label' => __( 'Image-1', 'designfly' ), |
||||||||
| 248 | 'section' => 'designfly-features-section', |
||||||||
| 249 | 'settings' => 'designfly-features-image-1', |
||||||||
| 250 | 'width' => 50, |
||||||||
| 251 | 'height' => 50, |
||||||||
| 252 | ) ) ); |
||||||||
| 253 | |||||||||
| 254 | /* Features block-2 */ |
||||||||
| 255 | // 'Features' title |
||||||||
| 256 | $wp_customize -> add_setting( 'designfly-features-title-2', array( |
||||||||
| 257 | 'default' => 'Title Text' |
||||||||
| 258 | ) ); |
||||||||
| 259 | |||||||||
| 260 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-features-title-control-2', |
||||||||
| 261 | array( |
||||||||
| 262 | 'label' => __( 'Title-2', 'designfly' ), |
||||||||
| 263 | 'section' => 'designfly-features-section', |
||||||||
| 264 | 'settings' => 'designfly-features-title-2', |
||||||||
| 265 | ) ) ); |
||||||||
| 266 | |||||||||
| 267 | // 'Features' paragraph |
||||||||
| 268 | $wp_customize -> add_setting( 'designfly-features-para-2', array( |
||||||||
| 269 | 'default' => 'Description about the service...' |
||||||||
| 270 | ) ); |
||||||||
| 271 | |||||||||
| 272 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-features-para-control-2', |
||||||||
| 273 | array( |
||||||||
| 274 | 'label' => __( 'Description-2', 'designfly' ), |
||||||||
| 275 | 'section' => 'designfly-features-section', |
||||||||
| 276 | 'settings' => 'designfly-features-para-2', |
||||||||
| 277 | 'type' => 'textarea', |
||||||||
| 278 | ) ) ); |
||||||||
| 279 | |||||||||
| 280 | // 'Features' Image |
||||||||
| 281 | $wp_customize -> add_setting( 'designfly-features-image-2' ); |
||||||||
| 282 | |||||||||
| 283 | $wp_customize -> add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'designfly-features-image-control-2', |
||||||||
| 284 | array( |
||||||||
| 285 | 'label' => __( 'Image-2', 'designfly' ), |
||||||||
| 286 | 'section' => 'designfly-features-section', |
||||||||
| 287 | 'settings' => 'designfly-features-image-2', |
||||||||
| 288 | 'width' => 50, |
||||||||
| 289 | 'height' => 50, |
||||||||
| 290 | ) ) ); |
||||||||
| 291 | |||||||||
| 292 | /* Features block-1 */ |
||||||||
| 293 | // 'Features' title |
||||||||
| 294 | $wp_customize -> add_setting( 'designfly-features-title-3', array( |
||||||||
| 295 | 'default' => 'Title Text' |
||||||||
| 296 | ) ); |
||||||||
| 297 | |||||||||
| 298 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-features-title-control-3', |
||||||||
| 299 | array( |
||||||||
| 300 | 'label' => __( 'Title-3', 'designfly' ), |
||||||||
| 301 | 'section' => 'designfly-features-section', |
||||||||
| 302 | 'settings' => 'designfly-features-title-3', |
||||||||
| 303 | ) ) ); |
||||||||
| 304 | |||||||||
| 305 | // 'Features' paragraph |
||||||||
| 306 | $wp_customize -> add_setting( 'designfly-features-para-3', array( |
||||||||
| 307 | 'default' => 'Description about the service...' |
||||||||
| 308 | ) ); |
||||||||
| 309 | |||||||||
| 310 | $wp_customize -> add_control( new WP_Customize_Control( $wp_customize, 'designfly-features-para-control-3', |
||||||||
| 311 | array( |
||||||||
| 312 | 'label' => __( 'Description-3', 'designfly' ), |
||||||||
| 313 | 'section' => 'designfly-features-section', |
||||||||
| 314 | 'settings' => 'designfly-features-para-3', |
||||||||
| 315 | 'type' => 'textarea', |
||||||||
| 316 | ) ) ); |
||||||||
| 317 | |||||||||
| 318 | // 'Features' Image |
||||||||
| 319 | $wp_customize -> add_setting( 'designfly-features-image-3' ); |
||||||||
| 320 | |||||||||
| 321 | $wp_customize -> add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'designfly-features-image-control-3', |
||||||||
| 322 | array( |
||||||||
| 323 | 'label' => __( 'Image-3', 'designfly' ), |
||||||||
| 324 | 'section' => 'designfly-features-section', |
||||||||
| 325 | 'settings' => 'designfly-features-image-3', |
||||||||
| 326 | 'width' => 50, |
||||||||
| 327 | 'height' => 50, |
||||||||
| 328 | ) ) ); |
||||||||
| 329 | } |
||||||||
| 330 | |||||||||
| 331 | /** |
||||||||
| 332 | * this function calls all helper function to register all theme mods |
||||||||
| 333 | * |
||||||||
| 334 | * @since 1.0.5 |
||||||||
| 335 | */ |
||||||||
| 336 | function designfly_theme_mods( $wp_customize ) { |
||||||||
| 337 | register_features_mods( $wp_customize ); |
||||||||
| 338 | register_home_mods( $wp_customize ); |
||||||||
| 339 | register_footer_mods( $wp_customize ); |
||||||||
| 340 | } |
||||||||
| 341 | |||||||||
| 342 | add_action( 'customize_register', 'designfly_theme_mods' ); |
||||||||
| 343 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths