Skip to content

Instantly share code, notes, and snippets.

View ajskelton's full-sized avatar

Anthony ajskelton

View GitHub Profile
body {
font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Helvetica, Arial, sans-serif;
}
@ajskelton
ajskelton / custom-post-type-labels.php
Created February 17, 2017 01:23
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 ) {
@ajskelton
ajskelton / _footer-widgets.scss
Created February 11, 2017 13:40
Genesis Footer Widget Widths based on number of Footer Widgets - by Dave Browne
$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',
@ajskelton
ajskelton / WP Customizer - Color Control
Last active July 17, 2020 05:05
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
@ajskelton
ajskelton / WP Customizer - Time
Last active March 24, 2022 08:44
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' ),
@ajskelton
ajskelton / WP Customizer - Number
Last active May 28, 2022 14:13
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' ),
@ajskelton
ajskelton / WP Customizer - Dropdown-pages
Last active February 13, 2023 08:04
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.' ),
@ajskelton
ajskelton / WP Customizer - Select
Last active June 24, 2021 19:36
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' ),
@ajskelton
ajskelton / WP Customizer - Radio Buttons
Last active December 7, 2022 04:48
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' ),