当前位置: 首页>>代码示例>>PHP>>正文


PHP G1_Theme函数代码示例

本文整理汇总了PHP中G1_Theme函数的典型用法代码示例。如果您正苦于以下问题:PHP G1_Theme函数的具体用法?PHP G1_Theme怎么用?PHP G1_Theme使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了G1_Theme函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: die

<?php

/**
 * Template Name: Page: Full Sections Product
 *
 * For the full license information, please view the Licensing folder
 * that was distributed with this source code.
 *
 * @package G1_Framework
 * @subpackage G1_Theme03
 * @since G1_Theme03 1.0.0
 */
// Prevent direct script access
if (!defined('ABSPATH')) {
    die('No direct script access allowed');
}
// Add proper body classes
add_filter('body_class', array(G1_Theme(), 'secondary_none_body_class'));
add_filter('body_class', array(G1_Theme(), 'primary_full_body_class'));
get_header();
?>
	<?php 
get_template_part('template-parts/g1_primary_page_post');
get_footer();
开发者ID:aragonc,项目名称:3clicks,代码行数:24,代码来源:g1_template_page_full_product.php

示例2: die

/**
 * The Template (full width) for displaying single post.
 *
 * For the full license information, please view the Licensing folder
 * that was distributed with this source code.
 *
 * @package G1_Framework
 * @subpackage G1_Theme03
 * @since G1_Theme03 1.0.0
 */
// Prevent direct script access
if (!defined('ABSPATH')) {
    die('No direct script access allowed');
}
// Add proper body classes
add_filter('body_class', array(G1_Theme(), 'secondary_none_body_class'));
get_header();
?>
    <div id="primary">
        <div id="content" role="main">

            <?php 
while (have_posts()) {
    the_post();
    ?>
                <?php 
    get_template_part('template-parts/g1_entry_full', get_post_format());
    ?>
            <?php 
}
// end of the loop.
开发者ID:aragonc,项目名称:3clicks,代码行数:31,代码来源:g1_template_single_full.php

示例3: g1_get_theme_option

/**
 * Gets a theme option
 */
function g1_get_theme_option($base, $key, $default = false)
{
    static $storage_values = null;
    $storage_name = G1_Theme()->get_id();
    if (null === $storage_values || defined('G1_CUSTOMIZE_MODE')) {
        $storage_values = get_option($storage_name, array());
    }
    $option_name = $base;
    if (strlen($key) > 0) {
        $option_name .= '_' . $key;
    }
    $result = isset($storage_values[$option_name]) ? $storage_values[$option_name] : $default;
    return $result;
}
开发者ID:aragonc,项目名称:3clicks,代码行数:17,代码来源:theme-functions.php

示例4: setup_redux_framework_options

function setup_redux_framework_options()
{
    $args = array();
    // Setting dev mode to true allows you to view the class settings/info in the panel.
    // Default: true
    $args['dev_mode'] = false;
    // Set the icon for the dev mode tab.
    // If $args['icon_type'] = 'image', this should be the path to the icon.
    // If $args['icon_type'] = 'iconfont', this should be the icon name.
    // Default: info-sign
    //$args['dev_mode_icon'] = 'info-sign';
    // Set the class for the dev mode tab icon.
    // This is ignored unless $args['icon_type'] = 'iconfont'
    // Default: null
    $args['dev_mode_icon_class'] = 'icon-large';
    // If you want to use Google Webfonts, you MUST define the api key.
    $args['google_api_key'] = 'AIzaSyARJV95W1bhfrtQ2trA9FUxMGKHqpYkLS0';
    // Define the starting tab for the option panel.
    // Default: '0';
    //$args['last_tab'] = '0';
    // Define the option panel stylesheet. Options are 'standard', 'custom', and 'none'
    // If only minor tweaks are needed, set to 'custom' and override the necessary styles through the included custom.css stylesheet.
    // If replacing the stylesheet, set to 'none' and don't forget to enqueue another stylesheet!
    // Default: 'standard'
    $args['admin_stylesheet'] = 'custom';
    // Add HTML before the form.
    //$args['intro_text'] = __('<p>This text is displayed above the options panel. It isn\'t required, but more info is always better! The intro_text field accepts all HTML.</p>', Redux_TEXT_DOMAIN);
    // Add content after the form.
    //$args['footer_text'] = __('<p>This text is displayed below the options panel. It isn\'t required, but more info is always better! The footer_text field accepts all HTML.</p>', Redux_TEXT_DOMAIN);
    // Set footer/credit line.
    //$args['footer_credit'] = __('<p>This text is displayed in the options panel footer across from the WordPress version (where it normally says \'Thank you for creating with WordPress\'). This field accepts all HTML.</p>', Redux_TEXT_DOMAIN);
    // Setup custom links in the footer for share icons
    $args['share_icons']['twitter'] = array('link' => 'http://twitter.com/bringthepixel', 'title' => 'Follow us on Twitter', 'img' => Redux_OPTIONS_URL . 'img/social/Twitter.png');
    $args['share_icons']['facebook'] = array('link' => 'http://www.facebook.com/bringthepixel', 'title' => 'Find us on Facebook', 'img' => Redux_OPTIONS_URL . 'img/social/Facebook.png');
    // Enable the import/export feature.
    // Default: true
    $args['show_import_export'] = true;
    // Set the icon for the import/export tab.
    // If $args['icon_type'] = 'image', this should be the path to the icon.
    // If $args['icon_type'] = 'iconfont', this should be the icon name.
    // Default: refresh
    //$args['import_icon'] = 'refresh';
    // Set the class for the import/export tab icon.
    // This is ignored unless $args['icon_type'] = 'iconfont'
    // Default: null
    $args['import_icon_class'] = 'icon-large';
    // Set a custom option name. Don't forget to replace spaces with underscores!
    $args['opt_name'] = G1_Theme()->get_id();
    $args['sections_filter_name'] = '3clicks';
    $args['skin_options'] = array('style_ui_corners', 'style_background', 'style_background_switch', 'style_background_image', 'style_background_image_hdpi', 'style_background_repeat', 'style_background_position', 'style_background_attachment', 'style_background_scroll', 'style_top_background', 'style_top_background_switch', 'style_top_background_image', 'style_top_background_image_hdpi', 'style_top_background_repeat', 'style_top_background_position', 'style_top_background_attachment', 'style_top_background_scroll', 'style_fonts_regular_type', 'style_fonts_regular_google_font', 'style_fonts_regular_size', 'style_fonts_meta_type', 'style_fonts_meta_google_font', 'style_fonts_important_type', 'style_fonts_important_google_font', 'style_fonts_important_size', 'style_fonts_primary_nav_type', 'style_fonts_primary_nav_google_font', 'style_fonts_primary_nav_size', 'style_fonts_primary_nav_padding_top', 'style_fonts_primary_nav_padding_bottom', 'ta_preheader_open_type', 'ta_preheader_open_on_startup', 'ta_preheader_space', 'ta_preheader_top_divider_switch', 'ta_preheader_top_divider_color', 'ta_preheader_top_divider_width', 'ta_preheader_bottom_divider_switch', 'ta_preheader_bottom_divider_color', 'ta_preheader_bottom_divider_width', 'ta_preheader_layout', 'ta_preheader_composition', 'ta_preheader_g1_social_icons', 'ta_preheader_searchform', 'ta_preheader_cs_1_background', 'ta_preheader_cs_1_background_opacity', 'ta_preheader_cs_1_background_switch', 'ta_preheader_cs_1_background_image', 'ta_preheader_cs_1_background_image_hdpi', 'ta_preheader_cs_1_background_repeat', 'ta_preheader_cs_1_background_position', 'ta_preheader_cs_1_background_attachment', 'ta_preheader_cs_1_text1', 'ta_preheader_cs_1_text2', 'ta_preheader_cs_1_text3', 'ta_preheader_cs_1_link', 'ta_preheader_cs_1_link_hover', 'ta_preheader_cs_2_background', 'ta_preheader_cs_2_text1', 'ta_header_position', 'ta_header_space', 'ta_header_top_divider_switch', 'ta_header_top_divider_color', 'ta_header_top_divider_width', 'ta_header_bottom_divider_switch', 'ta_header_bottom_divider_color', 'ta_header_bottom_divider_width', 'ta_header_layout', 'ta_header_composition', 'ta_header_id_margin_top', 'ta_header_id_margin_bottom', 'ta_header_primary_nav_margin_top', 'ta_header_primary_nav_margin_bottom', 'ta_header_tagline', 'ta_header_searchform', 'ta_header_primary_nav_style', 'ta_header_cs_1_background', 'ta_header_cs_1_background_opacity', 'ta_header_cs_1_background_switch', 'ta_header_cs_1_background_image', 'ta_header_cs_1_background_image_hdpi', 'ta_header_cs_1_background_repeat', 'ta_header_cs_1_background_position', 'ta_header_cs_1_background_attachment', 'ta_header_cs_1_text1', 'ta_header_cs_1_text2', 'ta_header_cs_1_text3', 'ta_header_cs_1_link', 'ta_header_cs_1_link_hover', 'ta_header_cs_2_background', 'ta_header_cs_2_text1', 'ta_precontent_space', 'ta_precontent_top_divider_switch', 'ta_precontent_top_divider_color', 'ta_precontent_top_divider_width', 'ta_precontent_bottom_divider_switch', 'ta_precontent_bottom_divider_color', 'ta_precontent_bottom_divider_width', 'ta_precontent_layout', 'ta_precontent_cs_1_background', 'ta_precontent_cs_1_background_opacity', 'ta_precontent_cs_1_background_switch', 'ta_precontent_cs_1_background_image', 'ta_precontent_cs_1_background_image_hdpi', 'ta_precontent_cs_1_background_repeat', 'ta_precontent_cs_1_background_position', 'ta_precontent_cs_1_background_attachment', 'ta_precontent_cs_1_text1', 'ta_precontent_cs_1_text2', 'ta_precontent_cs_1_text3', 'ta_precontent_cs_1_link', 'ta_precontent_cs_1_link_hover', 'ta_precontent_cs_2_background', 'ta_precontent_cs_2_text1', 'ta_content_space', 'ta_content_top_divider_switch', 'ta_content_top_divider_color', 'ta_content_top_divider_width', 'ta_content_bottom_divider_switch', 'ta_content_bottom_divider_color', 'ta_content_bottom_divider_width', 'ta_content_layout', 'ta_content_cs_1_background', 'ta_content_cs_1_background_opacity', 'ta_content_cs_1_background_switch', 'ta_content_cs_1_background_image', 'ta_content_cs_1_background_image_hdpi', 'ta_content_cs_1_background_repeat', 'ta_content_cs_1_background_position', 'ta_content_cs_1_background_attachment', 'ta_content_cs_1_text1', 'ta_content_cs_1_text2', 'ta_content_cs_1_text3', 'ta_content_cs_1_link', 'ta_content_cs_1_link_hover', 'ta_content_cs_2_background', 'ta_content_cs_2_text1', 'ta_prefooter_space', 'ta_prefooter_top_divider_switch', 'ta_prefooter_top_divider_color', 'ta_prefooter_top_divider_width', 'ta_prefooter_bottom_divider_switch', 'ta_prefooter_bottom_divider_color', 'ta_prefooter_bottom_divider_width', 'ta_prefooter_layout', 'ta_prefooter_composition', 'ta_prefooter_twitter_toolbar', 'ta_prefooter_gmap', 'ta_prefooter_cs_1_background', 'ta_prefooter_cs_1_background_opacity', 'ta_prefooter_cs_1_background_switch', 'ta_prefooter_cs_1_background_image', 'ta_prefooter_cs_1_background_image_hdpi', 'ta_prefooter_cs_1_background_repeat', 'ta_prefooter_cs_1_background_position', 'ta_prefooter_cs_1_background_attachment', 'ta_prefooter_cs_1_text1', 'ta_prefooter_cs_1_text2', 'ta_prefooter_cs_1_text3', 'ta_prefooter_cs_1_link', 'ta_prefooter_cs_1_link_hover', 'ta_prefooter_cs_2_background', 'ta_prefooter_cs_2_text1', 'ta_footer_space', 'ta_footer_top_divider_switch', 'ta_footer_top_divider_color', 'ta_footer_top_divider_width', 'ta_footer_bottom_divider_switch', 'ta_footer_bottom_divider_color', 'ta_footer_bottom_divider_width', 'ta_footer_layout', 'ta_footer_composition', 'ta_footer_cs_1_background', 'ta_footer_cs_1_background_opacity', 'ta_footer_cs_1_background_switch', 'ta_footer_cs_1_background_image', 'ta_footer_cs_1_background_image_hdpi', 'ta_footer_cs_1_background_repeat', 'ta_footer_cs_1_background_position', 'ta_footer_cs_1_background_attachment', 'ta_footer_cs_1_text1', 'ta_footer_cs_1_text2', 'ta_footer_cs_1_text3', 'ta_footer_cs_1_link', 'ta_footer_cs_1_link_hover', 'ta_footer_cs_2_background', 'ta_footer_cs_2_text1', 'map_color', 'map_invert_lightness');
    // Set a custom menu icon.
    //$args['menu_icon'] = '';
    // Set a custom title for the options page.
    // Default: Options
    $args['menu_title'] = __('Theme Options', Redux_TEXT_DOMAIN);
    // Set a custom page title for the options page.
    // Default: Options
    $args['page_title'] = __('Theme Options', Redux_TEXT_DOMAIN);
    // Set a custom page slug for options page (wp-admin/themes.php?page=***).
    // Default: redux_options
    $args['page_slug'] = 'g1_theme_options';
    // Register theme options page under 'Appearance'
    $args['page_type'] = 'submenu';
    $args['page_parent'] = 'themes.php';
    // Set a custom page capability.
    // Default: manage_options
    //$args['page_cap'] = 'manage_options';
    // Set the menu type. Set to "menu" for a top level menu, or "submenu" to add below an existing item.
    // Default: menu
    //$args['page_type'] = 'submenu';
    // Set the parent menu.
    // Default: themes.php
    // A list of available parent menus is available at http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
    //$args['page_parent'] = 'options_general.php';
    // Set a custom page location. This allows you to place your menu where you want in the menu order.
    // Must be unique or it will override other items!
    // Default: null
    //$args['page_position'] = null;
    // Set a custom page icon class (used to override the page icon next to heading)
    //$args['page_icon'] = 'icon-themes';
    // Set the icon type. Set to "iconfont" for Font Awesome, or "image" for traditional.
    // Redux no longer ships with standard icons!
    // Default: iconfont
    //$args['icon_type'] = 'image';
    // Disable the panel sections showing as submenu items.
    // Default: true
    //$args['allow_sub_menu'] = false;
    // Set ANY custom page help tabs, displayed using the new help tab API. Tabs are shown in order of definition.
    //$args['help_tabs'][] = array(
    //    'id' => 'redux-opts-1',
    //    'title' => __('Theme Information 1', Redux_TEXT_DOMAIN),
    //    'content' => __('<p>This is the tab content, HTML is allowed.</p>', Redux_TEXT_DOMAIN)
    //);
    //$args['help_tabs'][] = array(
    //    'id' => 'redux-opts-2',
    //    'title' => __('Theme Information 2', Redux_TEXT_DOMAIN),
    //    'content' => __('<p>This is the tab content, HTML is allowed.</p>', Redux_TEXT_DOMAIN)
    //);
    // Set the help sidebar for the options page.
    //$args['help_sidebar'] = __('<p>This is the sidebar content, HTML is allowed.</p>', Redux_TEXT_DOMAIN);
//.........这里部分代码省略.........
开发者ID:aragonc,项目名称:3clicks,代码行数:101,代码来源:options.php

示例5: do_action

do_action('g1_header_before');
?>
	<!-- BEGIN #g1-header -->
    <div id="g1-header-waypoint">
	<div id="g1-header" class="g1-header" role="banner">
        <div class="g1-layout-inner">
            <?php 
/* Executes a custom hook.
 * If you want to add some content before the g1-primary-bar, hook into 'g1_header_begin' action.
 */
do_action('g1_header_begin');
?>

            <div id="g1-primary-bar">
                <?php 
G1_Theme()->render_site_id();
?>
                <!-- END #g1-primary-nav -->
            </div><!-- END #g1-primary-bar -->

            <?php 
/* Executes a custom hook.
 * If you want to add some content after the g1-primary-bar, hook into 'g1_header_end' action.
 */
do_action('g1_header_end');
?>

		</div>

        <?php 
if ('none' !== g1_get_theme_option('general', 'scroll_to_top', 'standard')) {
开发者ID:aragonc,项目名称:3clicks,代码行数:31,代码来源:header-g1-simple.php

示例6: die

 *
 * For the full license information, please view the Licensing folder
 * that was distributed with this source code.
 *
 * @package G1_Framework
 * @subpackage G1_Theme03
 * @since G1_Theme03 1.0.0
 */
// Prevent direct script access
if (!defined('ABSPATH')) {
    die('No direct script access allowed');
}
// Add proper body classes
add_filter('body_class', array(G1_Theme(), 'secondary_none_body_class'));
add_filter('body_class', array(G1_Theme(), 'mediabox_narrow_body_class'));
add_filter('body_class', array(G1_Theme(), 'mediabox_after_body_class'));
get_header();
?>
    <div id="primary">
        <div id="content" role="main">

            <?php 
while (have_posts()) {
    the_post();
    ?>
                <?php 
    get_template_part('template-parts/g1_entry_half', get_post_format());
    ?>
            <?php 
}
?>
开发者ID:aragonc,项目名称:3clicks,代码行数:31,代码来源:g1_template_single_content_left.php

示例7: sanitize

 /**
  * Sanitizes the input value before saving it to a database
  *
  * @return array
  */
 public function sanitize($input)
 {
     $value = get_option(G1_Theme()->get_id() . '_image_sizes', array());
     $sizes = $this->get_sizes();
     // Create proper structure if needed
     foreach ($sizes as $size_name => $args) {
         if (!isset($value[$size_name]) || !is_array($value[$size_name])) {
             $value[$size_name] = array();
         }
     }
     // Replace values from theme options with values from input
     foreach ($sizes as $size_name) {
         if (isset($input[$size_name]) && isset($input[$size_name]['height'])) {
             $value[$size_name]['height'] = absint($input[$size_name]['height']);
         }
     }
     return $value;
 }
开发者ID:aragonc,项目名称:3clicks,代码行数:23,代码来源:theme.php

示例8: enqueue_scripts

 /**
  * Enqueues JavaScripts
  */
 public function enqueue_scripts()
 {
     // Prevent CSS|JS caching during updates
     $version = G1_Theme()->get_version();
     $parent_uri = trailingslashit(get_template_directory_uri());
     $child_uri = trailingslashit(get_stylesheet_directory_uri());
     $uri = get_template_directory_uri();
     wp_register_script('metadata', $parent_uri . 'js/jquery-metadata/jquery.metadata.js', array('jquery'), $version, true);
     wp_register_script('easing', $parent_uri . 'js/easing/jquery.easing.1.3.js', array('jquery'), $version, true);
     wp_register_script('g1_main', $parent_uri . 'js/main.js', array('jquery'), $version, true);
     wp_register_script('modernizr', $parent_uri . 'js/modernizr/modernizr.custom.js', array(), $version, false);
     wp_register_script('simplemodal', trailingslashit(G1_FRAMEWORK_URI) . 'js/jquery.simplemodal/js/jquery.simplemodal.1.4.1.min.js', array('jquery'), $version, true);
     wp_register_script('helpmode', trailingslashit(G1_FRAMEWORK_URI) . 'js/help-mode.js', array('jquery'), $version, true);
     wp_register_script('jquery.isotope', $parent_uri . 'js/jquery.isotope/jquery.isotope.min.js', array('jquery'), $version, true);
     wp_register_script('breakpoints', $parent_uri . 'js/breakpoints/breakpoints.js', array('jquery'), $version, true);
     wp_register_script('galleria', $parent_uri . 'js/galleria/galleria-1.2.9.min.js', array('jquery'), $version, true);
     wp_register_script('galleria_theme', $parent_uri . 'js/galleria/themes/classic/galleria.classic.js', array('galleria'), $version, true);
     wp_register_script('caroufredsel', $parent_uri . 'js/carouFredSel/jquery.carouFredSel-6.2.1-packed.js', array('jquery'), $version, true);
     wp_register_script('jquery.touchSwipe', $parent_uri . 'js/jquery.touchSwipe/jquery.touchSwipe.min.js', array('jquery'), $version, true);
     wp_register_script('jquery.waypoints', $parent_uri . 'js/jquery-waypoints/waypoints.min.js', array('jquery'), $version, true);
     wp_register_script('skrollr', $parent_uri . 'js/skrollr/skrollr.min.js', array(), '0.5.14', true);
     wp_register_script('jquery.magnific-popup', $parent_uri . 'js/jquery.magnific-popup/jquery.magnific-popup.min.js', array('jquery'), $version, true);
     wp_register_script('jquery.smoothscroll', $parent_uri . 'js/jquery.smoothscroll/jquery.smoothscroll.js', array('jquery'), $version, true);
     // Register child theme related scripts
     if ($parent_uri !== $child_uri) {
         wp_register_script('g1_child_main', $child_uri . 'modifications.js', array('jquery', 'g1_main'), false, true);
     }
     // Enqueue javascripts
     wp_enqueue_script('jquery');
     if (is_singular() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     wp_enqueue_script('metadata');
     wp_enqueue_script('easing');
     wp_enqueue_script('breakpoints');
     wp_enqueue_script('galleria');
     wp_enqueue_script('galleria_theme');
     wp_enqueue_script('caroufredsel');
     wp_enqueue_script('jquery.touchSwipe');
     wp_enqueue_script('jquery.waypoints');
     wp_enqueue_script('skrollr');
     wp_enqueue_script('jquery.magnific-popup');
     wp_enqueue_script('jquery.smoothscroll');
     wp_enqueue_script('g1_main');
     wp_enqueue_script('modernizr');
     $theme_data = array('uri' => $uri);
     wp_localize_script('g1_main', 'g1Theme', $theme_data);
     if (current_user_can('administrator') && 'none' !== g1_get_theme_option('general', 'helpmode')) {
         wp_enqueue_script('simplemodal');
         wp_enqueue_script('helpmode');
     }
     //Enqueue child theme related scripts
     if ($parent_uri !== $child_uri) {
         wp_enqueue_script('g1_child_main');
     }
 }
开发者ID:aragonc,项目名称:3clicks,代码行数:59,代码来源:theme-front.php

示例9: g1_gmaps_plugin_activate

 public function g1_gmaps_plugin_activate()
 {
     $migrated_map_id = get_option('g1_gmaps_migrated_map_id', false);
     if ($migrated_map_id) {
         return;
     }
     $options = get_option(G1_Theme()->get_id());
     $color = $options['map_color'];
     // hex or empty string
     $invert_lightness = $options['map_invert_lightness'] === '1';
     // bool
     $type = $options['map_type'];
     // roadmap | satellite | hybrid | terrain
     $center_lat = $options['map_latitude'];
     $center_long = $options['map_longitude'];
     $zoom = (int) $options['map_zoom'];
     // int
     $marker = $options['map_marker'];
     // none | standard | open-bubble
     $marker_icon = $options['map_marker_icon'];
     // image path
     $marker_content = $options['map_marker_content'];
     $marker_icon_id = null;
     if ($marker_icon) {
         $marker_icon_id = $this->get_image_id($marker_icon);
     }
     // create new map
     $defaults = G1_GMaps()->get_default_map_config();
     $config = array('width' => '', 'height' => '380', 'full_width' => 'standard', 'parallax' => 'standard', 'street_view_control' => 'none', 'overview_control' => 'none', 'scroll_wheel_to_zoom' => 'none', 'double_click_to_zoom' => 'standard', 'draggable' => 'standard', 'type_control' => 'horizontal', 'pan_control' => 'standard', 'scale_control' => 'none', 'zoom_control' => 'small');
     if ($center_lat) {
         $config['lat'] = $center_lat;
     }
     if ($center_long) {
         $config['long'] = $center_long;
     }
     if ($zoom) {
         $config['zoom'] = $zoom;
     }
     if ($type) {
         $config['type'] = $type;
     }
     if ($invert_lightness) {
         $config['invert_lightness'] = 'standard';
     }
     if ($color) {
         $c = new G1_Color($color);
         $config['color_hue'] = $c->get_hue();
         $config['color_saturation'] = $c->get_saturation() * 2 - 100;
         $config['color_lightness'] = $c->get_lightness() * 2 - 100;
         $config['custom_colors'] = 'standard';
     } else {
         $config['custom_colors'] = 'none';
     }
     $config = wp_parse_args($config, $defaults);
     $post = array('post_title' => 'Old map', 'post_status' => 'publish', 'post_type' => G1_GMaps()->get_post_type());
     $post_id = wp_insert_post($post);
     if ($post_id > 0) {
         $data_to_save = array();
         foreach ($config as $option_name => $option_value) {
             $data_to_save['map_' . $option_name] = $option_value;
         }
         update_post_meta($post_id, '_g1_gmap_lat', $data_to_save['map_lat']);
         update_post_meta($post_id, '_g1_gmap_long', $data_to_save['map_long']);
         update_post_meta($post_id, '_g1_gmap', $data_to_save);
         // create marker
         if ($marker !== 'none') {
             $marker_id = wp_insert_post(array('post_status' => 'publish', 'post_type' => G1_GMaps()->get_map_marker_post_type()));
             if ($marker_id > 0) {
                 $marker_data_to_save = G1_GMaps()->get_default_map_marker_config();
                 $marker_data_to_save['lat'] = $data_to_save['map_lat'];
                 $marker_data_to_save['long'] = $data_to_save['map_long'];
                 $marker_data_to_save['label'] = 'Marker';
                 if ($marker_icon_id) {
                     $marker_data_to_save['icon_id'] = $marker_icon_id;
                     $marker_data_to_save['icon_path'] = $marker_icon;
                 }
                 $marker_data_to_save['info'] = $marker_content;
                 $marker_data_to_save['info_state'] = $marker === 'open-bubble' ? 'standard' : 'none';
                 $marker_data_to_save['visibility'] = 'standard';
                 update_post_meta($marker_id, '_g1_gmap_id', $post_id);
                 update_post_meta($marker_id, '_g1_gmap_marker_lat', $marker_data_to_save['lat']);
                 update_post_meta($marker_id, '_g1_gmap_marker_long', $marker_data_to_save['long']);
                 update_post_meta($marker_id, '_g1_gmap_marker', $marker_data_to_save);
             }
         }
         update_option('g1_gmaps_migrated_map_id', $post_id);
         $global_map_enabled = $options['ta_prefooter_gmap'] === 'standard';
         // if map was enabled, we need to set it to new created map
         if ($global_map_enabled) {
             $options['ta_prefooter_gmap'] = $post_id;
             update_option(G1_Theme()->get_id(), $options);
         }
     }
 }
开发者ID:aragonc,项目名称:3clicks,代码行数:94,代码来源:theme-admin.php


注:本文中的G1_Theme函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。