Wsparcie » Motywy » problem "Cannot access property started with"

  • Witam,

    dziś sobie pisałem artykuły do wordpressa. Pisałe, pisałem i nagre coś nie gra. Jak wchodzę na stronę http://www.praktycznyrozwoj.pl to mi wywala taki błąd:

    „Fatal error: Cannot access property started with ” in /home/karol123/domains/praktycznyrozwoj.pl/public_html/wp-content/themes/musica/library/front.php on line 1840″

    Inne tematy działają czyli rzeczywiście to musi być w tym pliku problem.

    Jako że się nie znam za bardzo, wysyłam pełen kod pliku od lini 1800:

    $result = wp_remote_get( $geourl );
            if ( ! is_wp_error( $result ) && isset( $result['body'] ) ) {
                $result = json_decode( $result['body'] );
    
                if ( ! empty( $result->geoplugin_city ) && ! empty ( $result->geoplugin_countryName ) ) {
                    $location = $result->geoplugin_city . ', ' . $result->geoplugin_countryName;
                } elseif ( ! empty( $result->geoplugin_city ) && empty ( $result->geoplugin_countryName ) ) {
                    $location = $result->geoplugin_city;
                } elseif ( empty( $result->geoplugin_city ) && ! empty ( $result->geoplugin_countryName ) ) {
                    $location = $result->geoplugin_countryName;
                }
            }
        } else {
            $location = get_option( 'kopa_theme_options_weather_location', '' );
        }
    
        // NO LOCATION, ABORT ABORT!!!1!
        if( !isset($location) || !$location ) { return ''; }
    
        //FIND AND CACHE CITY ID
        $city_name_slug                 = sanitize_title( $location );
        $weather_transient_name         = 'kopa-awesome-weather-' . $units . '-' . $city_name_slug . "-". $locale;
    
        // GET WEATHER DATA
        if( get_transient( $weather_transient_name ) )
        {
            $weather_data = get_transient( $weather_transient_name );
        }
        else
        {
            // NOW
            $now_ping = "http://api.openweathermap.org/data/2.5/weather?q=" . $city_name_slug . "&lang=" . $locale . "&units=" . $units;
            $now_ping_get = wp_remote_get( $now_ping );
    
            if( is_wp_error( $now_ping_get ) )
            {
                return '';
            }   
    
            $city_data = json_decode( $now_ping_get['body'] );
    
            if( isset($city_data->cod) AND $city_data->cod == 404 )
            {
                return '';
            }
            else
            {
                $weather_data = $city_data;
            }
    
            if( $weather_data )
            {
                // SET THE TRANSIENT, CACHE FOR AN HOUR
                set_transient( $weather_transient_name, $weather_data, apply_filters( 'kopa_auto_awesome_weather_cache', 3600 ) );
            }
        }
    
        // NO WEATHER
        if( !$weather_data ) {
            return '';
        }
    
        // if location custom by admin, get the return name of openweather api
        if ( 'custom' == $kopa_weather_data_get_method ) {
            if ( ! empty( $kopa_weather_override_title ) ) {
                $location = $kopa_weather_override_title;
            } else {
                $location = $weather_data->name . ', ' . $weather_data->sys->country;
            }
        }
    
        ?>
        <div class="widget-area-1">
            <div class="widget clearfix widget_awesomeweatherwidget">
                <h6 class="widget-title"><?php echo get_option('kopa_theme_options_weather_title', __('Prognoza Pogody', kopa_get_domain())); ?></h6>
                <div class="awesome-weather-wrap awecf temp8 awe_without_stats awe_wide">
                    <div class="awesome-weather-header"><?php echo $location; ?></div>
                    <div class="awesome-weather-current-temp"><?php echo round( $weather_data->main->temp ); ?><sup>C</sup>
                    </div> <!-- /.awesome-weather-current-temp -->
                </div> <!-- /.awesome-weather-wrap -->
            </div>
        </div>
        <?php
    }
    
    /**
     * Template Tag: Facebook Comments Plugin
     */
    function kopa_facebook_comments() {
        if ( 'hide' == get_option('kopa_theme_options_facebook_comments_status', 'hide') ) {
            return;
        }
    
        $kopa_theme_options_facebook_comments_colorscheme = get_option('kopa_theme_options_facebook_comments_colorscheme', 'light');
        $kopa_theme_options_facebook_comments_num_of_posts = get_option('kopa_theme_options_facebook_comments_num_of_posts', 10);
    
        ?>
    
        <div class="fb-comments" data-href="<?php the_permalink(); ?>" data-colorscheme="<?php echo $kopa_theme_options_facebook_comments_colorscheme; ?>" data-numposts="<?php echo $kopa_theme_options_facebook_comments_num_of_posts; ?>" data-width="550"></div>
    
        <?php
    }

    linia 1840 to
    $city_data = json_decode( $now_ping_get[’body’] );

Viewing 1 replies (of 1 total)
  • powinno być raczej
    $city_data = json_decode( wp_remote_retrieve_body($now_ping_get) );

    Generalnie trzeba by sprawdzić co leci w $now_ping i co otrzymujesz w $now_ping_get

Viewing 1 replies (of 1 total)
  • Temat ‘problem "Cannot access property started with"’ jest zamknięty na nowe odpowiedzi.