За последние 24 часа нас посетили 22760 программистов и 1260 роботов. Сейчас ищут 760 программистов ...

Вставить ключ Google карты

Тема в разделе "Сделайте за меня", создана пользователем Arina, 1 авг 2017.

  1. Arina

    Arina Новичок

    С нами с:
    21 июн 2017
    Сообщения:
    13
    Симпатии:
    0
    Есть форма ввода для ключа, помогите пожалуйста

    PHP:
    1. $of_options[] = array( "name" => "",
    2.                                     "desc" => __('Укажите, ключ Google карты', 'iwebtheme'),
    3.                                     "id" => "maps",
    4.                                     "std" => "",
    5.                                     "fold" => "map_enable",
    6.                                     "type" => "textarea");
    Как вывести сюда


    PHP:
    1. // Ключ для google карты
    2.     if(is_page_template('templates/page-contact.php')) {
    3.     wp_enqueue_script('maps','https://maps.google.com/maps/api/js?sensor=true;language=ru&key=Как вывести ключ сюда ','jquery', '1.3', TRUE);
    4.         wp_enqueue_script('gmap', get_template_directory_uri() . '/js/jquery.gmap.min.js','jquery', '2.1.2', TRUE);
    5.     }
    6.    
     
  2. MouseZver

    MouseZver Суперстар

    С нами с:
    1 апр 2013
    Сообщения:
    7.751
    Симпатии:
    1.322
    Адрес:
    Лень
    в переменную $of_options[] записываются множество массивов? или только данный который вижу ?

    PHP:
    1. wp_enqueue_script('maps','https://maps.google.com/maps/api/js?sensor=true;language=ru&key=' . $of_options['desc'],'jquery', '1.3', TRUE);
     
  3. Arina

    Arina Новичок

    С нами с:
    21 июн 2017
    Сообщения:
    13
    Симпатии:
    0
    PHP:
    1. //Contact Settings
    2. $of_options[] = array(     "name"         => "Contact Settings",
    3.                         "type"         => "heading"
    4.                 );
    5.              
    6. $of_options[] = array( "name" => __('Включение или отключение карты на странице контактов', 'iwebtheme'),
    7.                     "desc" => __('Поставьте галочку, чтобы активировать карту на странице контактов', 'iwebtheme'),
    8.                     "id" => "map_enable",
    9.                     "std" => 1,
    10.                       "folds" => 1,
    11.                     "type" => "checkbox");
    12.                  
    13. $of_options[] = array( "name" => "",
    14.                                     "desc" => __('Укажите, ключ Google карты', 'iwebtheme'),
    15.                                     "id" => "maps",
    16.                                     "std" => "",
    17.                                     "fold" => "map_enable",
    18.                                     "type" => "textarea");                
    19.  
    20.                                  
    21.                 $of_options[] = array( "name" => "",
    22.                                     "desc" => __('Введите ваш адрес', 'iwebtheme'),
    23.                                     "id" => "map_address",
    24.                                     "std" => "Level 13, 2 Elizabeth St, Melbourne Victoria 3000 Australia",
    25.                                     "fold" => "map_enable", /* the checkbox hook */
    26.                                     "type" => "textarea");
    27.              
    28. $of_options[] = array(     "name"         => "Адрес электронной почты",
    29.                         "desc"         => "Введите ваш адрес электронной почты",
    30.                         "id"         => "contact_email",
    31.                         "std"         => "name@email.com",
    32.                         "type"         => "text"
    33.                 );
    34. $of_options[] = array(     "name"         => "Сообщение об успешном выполнении",
    35.                         "desc"         => "Это образец, скрытый вариант 2",
    36.                         "id"         => "contact_success",
    37.                         "std"         => "Спасибо! Ваше сообщение успешно отправлено.",
    38.                         "type"         => "text"
    39.                 );
     
    #3 Arina, 1 авг 2017
    Последнее редактирование модератором: 1 авг 2017
  4. Arina

    Arina Новичок

    С нами с:
    21 июн 2017
    Сообщения:
    13
    Симпатии:
    0
    Так вывожу количество записей, но с картой как-то не получается

    PHP:
    1. $of_options[] = array( "name" => __('Новые записи', 'iwebtheme'),
    2.                     "desc" => __('Укажите, сколько новых записей будут в сайтбаре', 'iwebtheme'),
    3.                     "id" => "posts_per_page",
    4.                     "type" => "text");
    PHP:
    1. <?php if(iwebtheme_smof_data('have_posts') != 0) { ?>
    2.  
    3. <?php { $posts_per_page = iwebtheme_smof_data('posts_per_page');
    4.         $caller_get_posts = '1';
    5.        $args=array(
    6.         'caller_get_posts' => $caller_get_posts,
    7.         'posts_per_page' => $posts_per_page);
    8.         query_posts($args);  
    9.         } ?>
    10.  
    11.  
    12.     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    13. <div class="widget"><a href="<?php the_permalink(); ?>">        <h5><?php the_title();?> </h5> </a>
    14.      <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail()) {the_post_thumbnail(array(),array("class"=>"alignleft post_thumbnail"));} ?></a>
    15. </div>
    16. <?php endwhile; else: ?>
    17. <?php endif; wp_reset_query(); ?>
    18. <?php } ?>