Skip to content

Instantly share code, notes, and snippets.

View Asikur22's full-sized avatar
๐Ÿ’œ
Web Developer | In Love with WordPress

Asiqur Rahman Asikur22

๐Ÿ’œ
Web Developer | In Love with WordPress
View GitHub Profile
@Asikur22
Asikur22 / webdev_online_resources.md
Created November 9, 2019 01:53 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@Asikur22
Asikur22 / Localhost Wordpress Permissions
Last active November 5, 2019 13:13 — forked from shawnrgrimes/Localhost Wordpress Permissions
Enable updating WordPress in a local environment on OS X (Updates, Themes and Plugins) #FilePermission
On Mac OS X (Leopard+), the Apache HTTP Server runs under the user account, _www which belongs to the group _www. To allow WordPress to configure wp-config.php during installation, update files during upgrades, and update the .htaccess file for pretty permalinks, give the server write permission on the files.
One way to do this is to change the owner of the wordpress directory and its contents to _www. Keep the group as staff, a group to which your user account belongs and give write permissions to the group.
$ cd /<wherever>/Sites/<thesite>
$ sudo chown -R _www wordpress
$ sudo chmod -R g+w wordpress
This way, the WordPress directories have a permission level of 775 and files have a permission level of 664. No file nor directory is world-writeable.
@Asikur22
Asikur22 / WP Customizer - Image Control
Last active November 21, 2019 23:24 — forked from ajskelton/WP Customizer - Image Control
Add a Image Field to WP Customizer
$wp_customize->add_setting( 'themeslug_media_setting_id', array(
'sanitize_callback' => 'absint',
'validate_callback' => 'themeslug_validate_image,
) );
$wp_customize->add_control(
new WP_Customize_Media_Control( $wp_customize, 'themeslug_media_setting_id', array(
'label' => __( 'Custom Core Media Setting' ),
'section' => 'custom_section', // Add a default or your own section
'mime_type' => 'image',
@Asikur22
Asikur22 / WP Customizer - Color Control
Created September 1, 2019 04:32 — forked from ajskelton/WP Customizer - Color Control
Add a Color Control field to the WordPress Customizer.
$wp_customize->add_setting( 'core_color_setting_id', array(
'sanitize_callback' => 'themeslug_sanitize_hex_color',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control( $wp_customize, 'core_color_setting_id',
array(
'label' => __( 'Core Color Setting' ),
'description' => __( 'Select a color for something' ),
'section' => 'custom_section', // Add a default or your own section
@Asikur22
Asikur22 / WP Customizer - Number
Created September 1, 2019 04:31 — forked from ajskelton/WP Customizer - Number
Add a Number field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_number_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_number_absint',
'default' => 1,
) );
$wp_customize->add_control( 'themeslug_number_setting_id', array(
'type' => 'number',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Number' ),
@Asikur22
Asikur22 / WP Customizer - Dropdown-pages
Created September 1, 2019 04:31 — forked from ajskelton/WP Customizer - Dropdown-pages
Add a Dropdown-pages field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_dropdownpages_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_dropdown_pages',
) );
$wp_customize->add_control( 'themeslug_dropdownpages_setting_id', array(
'type' => 'dropdown-pages',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Dropdown Pages' ),
'description' => __( 'This is a custom dropdown pages option.' ),
@Asikur22
Asikur22 / WP Customizer - Select
Created September 1, 2019 04:31 — 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' ),
@Asikur22
Asikur22 / WP Customizer - Radio Buttons
Created September 1, 2019 04:31 — forked from ajskelton/WP Customizer - Radio Buttons
Add a Radio field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_radio_setting_id', array(
'capability' => 'edit_theme_options',
'default' => 'blue',
'sanitize_callback' => 'themeslug_customizer_sanitize_radio',
) );
$wp_customize->add_control( 'themeslug_radio_setting_id', array(
'type' => 'radio',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Radio Selection' ),
@Asikur22
Asikur22 / WP Customizer - Checkbox
Created September 1, 2019 04:31 — 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.' ),
@Asikur22
Asikur22 / WP Customizer - Email
Created September 1, 2019 04:31 — forked from ajskelton/WP Customizer - Email
Add a Email field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_email_setting_id', array(
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => 'themeslug_sanitize_email',
) );
$wp_customize->add_control( 'themeslug_email_setting_id', array(
'type' => 'email',
'section' => 'custom_section', // Required, core or custom.
'label' => __( 'Custom Email' ),