Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $active_type="home";
- $wp_customize->add_setting($active_type.'_categories_max',array(
- 'default' => '10',
- 'transport' => 'refresh'
- ));
- $wp_customize->add_control( $active_type.'_categories_max',array(
- 'type' => 'select',
- 'label' => 'Max Items',
- 'section' => $active_type.'_categories_section',
- 'choices' => array(
- '5' => '2',
- '10' => '10',
- '15' => '15',
- '20' => '20',
- ),
- ));
- $test = get_theme_mod('home_categories_max');
- echo $test;
- {
- "2016-Foundation6-v0.6::single_categories_location_priority": {
- "value": "0",
- "type": "theme_mod",
- "user_id": 1
- }
- }
- {"success":true,"data":{"setting_validities":{"single_carousel_location":true},"changeset_status":"publish"
- ,"next_changeset_uuid":"9aff0388-b0bc-4be8-ba1a-2fd3cf24772c"}}
- {"success":false,"data":{"message":"","code":"changeset_already_published","data":null}}
- File: /wp-includes/theme.php
- 889: function set_theme_mod( $name, $value ) {
- 890: $mods = get_theme_mods();
- 891: $old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false;
- 892:
- 893: /**
- 894: * Filters the theme mod value on save.
- 895: *
- 896: * The dynamic portion of the hook name, `$name`, refers to the key name of
- 897: * the modification array. For example, 'header_textcolor', 'header_image',
- 898: * and so on depending on the theme options.
- 899: *
- 900: * @since 3.9.0
- 901: *
- 902: * @param string $value The new value of the theme mod.
- 903: * @param string $old_value The current value of the theme mod.
- 904: */
- 905: $mods[ $name ] = apply_filters( "pre_set_theme_mod_{$name}", $value, $old_value );
- 906:
- 907: $theme = get_option( 'stylesheet' );
- 908: update_option( "theme_mods_$theme", $mods );
- 909: }
- function _20161230_customize_register( $wp_customize ) {
- $active_type="home";
- $wp_customize->add_section( $active_type. 'just_listed' , array(
- 'title' => __( 'Just Listed Settings', 'microformata' ),
- 'priority' => 53,
- ) );
- $wp_customize->add_setting($active_type.'_categories_max',array(
- 'default' => '10',
- 'transport' => 'refresh'
- ));
- $wp_customize->add_control( $active_type.'_categories_max',array(
- 'type' => 'select',
- 'label' => 'Max Items',
- 'section' => $active_type.'just_listed',
- 'choices' => array(
- '5' => '2',
- '10' => '10',
- '15' => '15',
- '20' => '20',
- ),
- ));
- }
- add_action( 'customize_register', '_20161230_customize_register' );
- {success: true, data: {setting_validities: {home_categories_max: true}, changeset_status: "publish",…}}
- data
- :
- {setting_validities: {home_categories_max: true}, changeset_status: "publish",…}
- changeset_status
- :
- "publish"
- next_changeset_uuid
- :
- "4b1ac702-3ae2-422d-875a-a02b6f5b2d65"
- setting_validities
- :
- {home_categories_max: true}
- success
- :
- true
Add Comment
Please, Sign In to add comment