Skip to content

Instantly share code, notes, and snippets.

View Jespertastesen's full-sized avatar

Jesper Tastesen Jespertastesen

View GitHub Profile
@Jespertastesen
Jespertastesen / _footer-widgets.scss
Created May 27, 2017 16:08 — forked from ajskelton/_footer-widgets.scss
Genesis Footer Widget Widths based on number of Footer Widgets - by Dave Browne
@Jespertastesen
Jespertastesen / custom-post-type-labels.php
Created May 27, 2017 16:08 — forked from ajskelton/custom-post-type-labels.php
WordPress Custom Post Type Labels
/**
* Get the post type labels configuration
*
* @param string $post_type
* @param string $singular_label
* @param string $plural_label
*
* @return array
*/
function get_TODO_post_type_labels_config( $post_type, $singular_label, $plural_label ) {
$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',
@Jespertastesen
Jespertastesen / WP Customizer - Color Control
Created May 27, 2017 16:11 — 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
@Jespertastesen
Jespertastesen / WP Customizer - Time
Created May 27, 2017 16:12 — forked from ajskelton/WP Customizer - Time
Add a Time field to the WordPress Customizer. Includes sanitize function that formats the time as ('H:i')
$wp_customize->add_setting( 'themeslug_time_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => '',
'default' => 1,
) );
$wp_customize->add_control( 'themeslug_time_setting_id', array(
'type' => 'time',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Time' ),
@Jespertastesen
Jespertastesen / WP Customizer - Number
Created May 27, 2017 16:12 — 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' ),
@Jespertastesen
Jespertastesen / WP Customizer - Dropdown-pages
Created May 27, 2017 16:12 — 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.' ),
@Jespertastesen
Jespertastesen / WP Customizer - Select
Created May 27, 2017 16:12 — 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' ),
@Jespertastesen
Jespertastesen / WP Customizer - Radio Buttons
Created May 27, 2017 16:12 — 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' ),
@Jespertastesen
Jespertastesen / WP Customizer - Checkbox
Created May 27, 2017 16:13 — 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.' ),