Skip to content

Instantly share code, notes, and snippets.

View Yeadh's full-sized avatar
🏠
Work For ThemeBeyond

MD. YEADH HASAN BAPPY Yeadh

🏠
Work For ThemeBeyond
View GitHub Profile
@Yeadh
Yeadh / iph.php
Created September 22, 2019 06:50 — forked from L-P/iph.php
Image PlaceHolder for PHP
<?php
/** Image PlaceHolder for PHP.
* Usage : iph.php?<WIDTH>x<HEIGHT>/<COLOR>
* Ex : iph.php?800x600/FF00FF
* Author : Léo Peltier
* LICENSE : WTFPL
* */
return main();
@Yeadh
Yeadh / WP Customizer - Select
Created September 23, 2017 03:40 — forked from ajskelton/WP Customizer - Select
Add a Select field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_select_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_select',
'default' => 'value1',
) );
$wp_customize->add_control( 'themeslug_select_setting_id', array(
'type' => 'select',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Select Option' ),
@Yeadh
Yeadh / WP Customizer - Checkbox
Created September 23, 2017 03:27 — forked from ajskelton/WP Customizer - Checkbox
Add a Checkbox field to the WordPress Customizer.
$wp_customize->add_setting( 'themecheck_checkbox_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_checkbox',
) );
$wp_customize->add_control( 'themeslug_checkbox_setting_id', array(
'type' => 'checkbox',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Checkbox' ),
'description' => __( 'This is a custom checkbox input.' ),
@Yeadh
Yeadh / WP Customizer - Textarea
Created July 24, 2017 06:24 — forked from ajskelton/WP Customizer - Textarea
Add a Textarea field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_textarea_setting_id', array(
'capability' => 'edit_theme_options',
'default' => 'Lorem Ipsum Dolor Sit amet',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( 'themeslug_textarea_setting_id', array(
'type' => 'textarea',
'section' => 'custom_section', // // Add a default or your own section
'label' => __( 'Custom Text Area' ),
/**
* WP_Customize_Manager->add_setting(); // adds a new setting to the database
* WP_Customize_Manager->add_section(); // adds a new section (i.e. category/group) to the Theme Customizer page
* WP_Customize_Manager->add_control(); // creates an HTML control that admins can use to change settings.
* WP_Customize_Manager->get_setting(); // can be used to fetch any existing setting, in the event you need to modify something
*/
add_action( 'customize_register', 'my_customize_register' );
function my_customize_register( $wp_customize ) {