/** * Get the google fonts from the API or in the cache */ public function get_fonts($amount = 500) { $selectDirectory = get_template_directory() . '/inc/customizer/'; $selectDirectoryInc = get_template_directory() . '/inc/customizer/'; $finalselectDirectory = ''; if (is_dir($selectDirectory)) { $finalselectDirectory = $selectDirectory; } if (is_dir($selectDirectoryInc)) { $finalselectDirectory = $selectDirectoryInc; } $fontFile = $finalselectDirectory . '/json/google-web-fonts.json'; if (file_exists($fontFile)) { global $wp_filesystem; if (empty($wp_filesystem)) { tokopress_include_file(ABSPATH . '/wp-admin/includes/file.php'); WP_Filesystem(); } $content = json_decode($wp_filesystem->get_contents($fontFile)); } if ($amount == 'all') { return $content->items; } else { return array_slice($content->items, 0, $amount); } }
function tokopress_theme_customizer_register($wp_customize) { tokopress_include_file(trailingslashit(THEME_DIR) . 'inc/customizer/textarea-control.php'); tokopress_include_file(trailingslashit(THEME_DIR) . 'inc/customizer/googlefont-control.php'); // Rename Colors Sections Into General Colors $wp_customize->get_section('colors')->title = __('General Colors', 'tokopress'); $wp_customize->get_control('background_color')->priority = 0; $wp_customize->get_section('header_image')->priority = 30; $wp_customize->get_section('background_image')->priority = 35; $tk_sections = array(); $tk_colors = array(); $tk_panels = array(); $tk_sections = tokopress_get_customizer_sections($tk_sections); $tk_colors = tokopress_get_customizer_data($tk_colors); $tk_panels = tokopress_get_customizer_panel($tk_panels); // create panel from array data foreach ($tk_panels as $panels) { if (isset($panels['priority'])) { $priority = $panels['priority']; } else { $priority = ''; } $wp_customize->add_panel($panels['ID'], array('priority' => $panels['priority'], 'capability' => 'edit_theme_options', 'title' => $panels['title'], 'description' => $panels['description'])); } //create the section from array data foreach ($tk_sections as $section) { if (isset($section['priority'])) { $priority = $section['priority']; } else { $priority = ''; } if (isset($section['panel_id'])) { $panel = $section['panel_id']; } else { $panel = ''; } $wp_customize->add_section($section['slug'], array('title' => $section['label'], 'priority' => $priority, 'panel' => $panel)); } //create the componen from array data foreach ($tk_colors as $color) { if (isset($color['transport'])) { $transport = $color['transport']; } else { $transport = 'postMessage'; } if (isset($color['priority'])) { $priority = $color['priority']; } else { $priority = ''; } // Define each customizer type switch ($color['type']) { case 'color': $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'type' => 'theme_mod', 'transport' => $transport, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => $color['section'], 'priority' => $priority, 'settings' => $color['slug']))); break; case 'select': $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'type' => 'theme_mod', 'transport' => $transport, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => $color['section'], 'default' => $color['default'], 'priority' => $priority, 'settings' => $color['slug'], 'choices' => $color['choices'], 'type' => 'select'))); break; case 'select_font': $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'type' => 'theme_mod', 'transport' => $transport, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => $color['section'], 'default' => $color['default'], 'priority' => $priority, 'settings' => $color['slug'], 'choices' => $color['choices'], 'type' => 'select'))); break; case 'text': $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'type' => 'theme_mod', 'transport' => $transport, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control($color['slug'], array('label' => $color['label'], 'section' => $color['section'], 'priority' => $priority, 'settings' => $color['slug'], 'type' => 'text')); break; case 'textarea': $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new Tokopress_Customize_Textarea_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => $color['section'], 'priority' => $priority, 'settings' => $color['slug']))); break; case 'images': $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'capability' => 'edit_theme_options', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => $color['section'], 'priority' => $priority, 'settings' => $color['slug']))); break; case 'font': $wp_customize->add_setting($color['slug'], array('default' => $color['label'], 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new Google_Font_Dropdown_Custom_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => $color['section'], 'priority' => $priority, 'settings' => $color['slug']))); break; default: break; } } }
<?php /** * Theme Options Settings */ /* * Load Option Framework */ define('OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/option-framework/'); tokopress_include_file(get_template_directory() . '/inc/option-framework/options-framework.php'); /** * Set Option Name For Option Framework */ function optionsframework_option_name() { $optionsframework_settings = get_option('optionsframework'); if (defined('THEME_NAME')) { $optionsframework_settings['id'] = THEME_NAME; } else { $themename = wp_get_theme(); $themename = preg_replace("/\\W/", "_", strtolower($themename)); $optionsframework_settings['id'] = $themename; } update_option('optionsframework', $optionsframework_settings); $defaults = optionsframework_defaults(); add_option($optionsframework_settings['id'], $defaults, '', 'yes'); } /** * Get Default Options For Option Framework */ function optionsframework_defaults()
<?php /* Backward Compatibility for Marketica v1.x */ tokopress_include_file('page-contact-form.php'); exit;
/** * Theme Setup */ tokopress_include_file(get_template_directory() . '/inc/customizer/customizer-framework.php'); tokopress_include_file(get_template_directory() . '/inc/customizer/customizer-fonts.php'); tokopress_include_file(get_template_directory() . '/inc/functions/text-limiter.php'); tokopress_include_file(get_template_directory() . '/inc/functions/hybrid-media-grabber.php'); tokopress_include_file(get_template_directory() . '/inc/functions/contact-form.php'); tokopress_include_file(get_template_directory() . '/inc/functions/breadcrumb.php'); tokopress_include_file(get_template_directory() . '/inc/theme/frontend.php'); tokopress_include_file(get_template_directory() . '/inc/theme/options.php'); tokopress_include_file(get_template_directory() . '/inc/theme/designs.php'); tokopress_include_file(get_template_directory() . '/inc/theme/plugins.php'); tokopress_include_file(get_template_directory() . '/inc/theme/update.php'); tokopress_include_file(get_template_directory() . '/inc/widget/widget_subscribe.php'); tokopress_include_file(get_template_directory() . '/inc/widget/widget_statistic.php'); tokopress_include_file(get_template_directory() . '/inc/widget/widget_social.php'); if (class_exists('woocommerce')) { tokopress_include_file(get_template_directory() . '/inc/woocommerce/frontend.php'); tokopress_include_file(get_template_directory() . '/inc/woocommerce/options.php'); tokopress_include_file(get_template_directory() . '/inc/woocommerce/metabox.php'); tokopress_include_file(get_template_directory() . '/inc/woocommerce/functions.php'); tokopress_include_file(get_template_directory() . '/inc/woocommerce/designs.php'); if (class_exists('WC_Vendors')) { tokopress_include_file(get_template_directory() . '/inc/woocommerce/plugin-wcvendors.php'); } if (class_exists('WeDevs_Dokan')) { tokopress_include_file(get_template_directory() . '/inc/woocommerce/plugin-dokan.php'); } }
<?php /* Backward Compatibility for Marketica v1.x */ tokopress_include_file('page-notitle.php'); exit;