1

こんにちは現在、私はワードプレスのテーマでシンプルな天気 JS ( http://simpleweatherjs.com/ ) を使用して、ライブの天気を表示し、オプションにも redux フレームワークを使用しています。「あなたの都市の名前」のテキスト フィールドを作成しました。オプションの一意の ID は > 「cpv-hm-cat-op-8」です。My Redux フレームワーク オプションのプレビューは以下のとおりです。

array(
'id'       => 'cpv-hm-cat-op-8',
'type'     => 'text',
'title'    => __( 'Name of your city', 'redux' ),
'desc'    => __( 'Write your city which you want to show in weather', 'redux' ),
'default'  => 'New York',
), 

今、私は単純な天気 JS ファイルでそのオプションを使用したいと思います。私の都市の名前を入力すると、その都市の天気が表示されます。単純な天気 js オプションは次のようになります =>

  $.simpleWeather({
    location: 'New Jersey',
    woeid: '',
    unit: 'c',
    success: function(weather) {
      html = '<h2><i class="symbol-weather  icon-'+weather.code+'"></i> '+weather.temp+'&deg;'+weather.units.temp+'</h2>';
      html += '<ul><li>'+weather.city+'</li>';  
      $("#weather").html(html);
    },
    error: function(error) {
      $("#weather").html('<p>'+error+'</p>');
    }
  });

ここで「場所」に redux プラグイン オプションを追加します。しかし、それは機能していません。

  $.simpleWeather({
    location: '<?php global $cpv; echo $cpv['cpv-hm-cat-op-8'];?>',

redux フレームワーク オプションをそこに追加する方法を教えてください。

4

1 に答える 1