if (!function_exists('xinmag_top_categories')) { function xinmag_top_categories() { $args = array('orderby' => 'count', 'order' => 'DESC', 'parent' => 0); $categories = get_categories($args); return apply_filters('xinmag_top_categories', $categories); } } function xinmag_custom_css() { global $xinmag_options, $xinwp_fonts; // Inpage CSS echo '<!-- Custom CSS Styles -->' . "\n"; echo '<style type="text/css" media="screen">' . "\n"; if (!empty($xinmag_options['xinmag_scheme_css'])) { echo $xinmag_options['xinmag_scheme_css'] . "\n"; } if (!empty($xinmag_options['xinmag_inline_css'])) { echo $xinmag_options['xinmag_inline_css'] . "\n"; } echo '</style>' . "\n"; } add_action('wp_head', 'xinmag_custom_css'); require_once get_template_directory() . '/inc/lib-content.php'; require_once get_template_directory() . '/scheme/scheme.php'; if (is_admin()) { require_once get_template_directory() . '/inc/theme-options.php'; } $xinmag_options = xinwp_get_options(); //Global Theme Options $xinwp_options = $xinmag_options;
function xinmag_theme_options_validate($input) { $theme_options = xinmag_theme_options_array(); foreach ($theme_options as $theme_option) { switch ($theme_option['type']) { case 'checkbox': if (!isset($input[$theme_option['name']])) { $input[$theme_option['name']] = null; } $input[$theme_option['name']] = $input[$theme_option['name']] == 1 ? 1 : 0; break; case 'text': case 'textarea': $input[$theme_option['name']] = wp_kses_stripslashes($input[$theme_option['name']]); break; case 'number': $input[$theme_option['name']] = intval($input[$theme_option['name']]); break; case 'url': case 'image': $input[$theme_option['name']] = esc_url_raw($input[$theme_option['name']]); break; case 'color': $input[$theme_option['name']] = sanitize_text_field($input[$theme_option['name']]); break; } } if ($input['respbp'] < 960) { $input['respbp'] = 960; } $input['xinmag_scheme_css'] = xinmag_scheme_css($input); //Update Scheme Options $options = xinwp_get_options(); if ($input['colorscheme'] != $options['colorscheme']) { $scheme = $theme_options['colorscheme']['values'][$input['colorscheme']]; $input['schemecss'] = $scheme['css']; foreach ($scheme['options'] as $scheme_options) { $input[$scheme_options['name']] = $scheme_options['value']; } } return $input; }