$r, 'g' => $g, 'b' => $b, 'a' => 1 ) ).')'; } return strpos( trim( $color ), 'rgb' ) !== false ? $color : false; } /** * vaild int. */ function NovelLite_sanitize_int( $input ) { $return = absint($input); return $return; } // Multiple Checkbox Show function NovelLite_checkbox_explode( $values ) { $multi_values = !is_array( $values ) ? explode( ',', $values ) : $values; return !empty( $multi_values ) ? array_map( 'sanitize_text_field', $multi_values ) : array(); } function NovelLite_custom_customize_register( $wp_customize ) { class NovelLite_Misc_Control extends WP_Customize_Control{ public function render_content() { switch ( $this->type ) { default: case 'heading': echo '' . $this->title . ''; break; case 'custom_message' : echo '

' . $this->description . '

'; break; case 'hr' : echo '
'; break; } } } /** * Multiple checkbox customize control class. * * @since 1.0.0 * @access public */ class TH_Customize_Control_Checkbox_Multiple extends WP_Customize_Control { /** * The type of customize control being rendered. * * @since 1.0.0 * @access public * @var string */ public $type = 'checkbox-multiple'; /** * Enqueue scripts/styles. * * @since 1.0.0 * @access public * @return void */ public function enqueue() { } /** * Displays the control content. * * @since 1.0.0 * @access public * @return void */ public function render_content() { if ( empty( $this->choices ) ){ return; } ?> label ) ) : ?> label ); ?> description ) ) : ?> description; ?> value() ) ? explode( ',', $this->value() ) : $this->value(); ?> link(); ?> value="" /> '_wp_page_template', 'meta_value' => 'template-frontpage.php' )); $post_id = isset($pages[0]->ID)?$pages[0]->ID:false; if(empty($pages)){ $post_id = wp_insert_post(array ( 'post_type' => 'page', 'post_title' => 'Home Page', 'post_content' => '', 'post_status' => 'publish', 'comment_status' => 'closed', // if you prefer 'ping_status' => 'closed', // if you prefer 'page_template' =>'template-frontpage.php', //Sets the template for the page. )); } if($post_id){ update_option( 'page_on_front', $post_id ); update_option( 'show_on_front', 'page' ); } wp_die(); // this is required to terminate immediately and return a proper response } ?>