mercredi 29 juin 2016

How to use Redux Framework Text Field option for Simple Weather JS

Hello Currently i am using Simple weather JS (http://ift.tt/ZDU7Gn) in my wordpress theme for showing live weather and also for options i am using redux framework. i've create a text field for "Name of your City" and my Option Unique ID is > " cpv-hm-cat-op-8 ". Preview of My Redux framework option is below.

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',
), 

Now i want to use that option in my simple weather JS file and i want my output, when i input name of my city its show in weather of that city. simple weather js option look like =>

  $.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>');
    }
  });

Here "Location" i want to add my redux plugin option. but its not working.

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

Kindly Help me how can i add there my redux framework option.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire