• Resolved vinay404

    (@vinay404)


    Hi, I am using houzez theme, and i have city taxonomy term in my theme, so i have created a template to display current property’s city detail like About London city, and discription, I want to show weather discription below that info of that city. its not about geolocation, I want to show the city weather of current page automaticaly. user can be viewing from anywhere,

    Here is the code i am using, how can i disply that city weather in it.

    <?php
    /**
     * Created by PhpStorm.
     * User: waqasriaz
     * Date: 21/01/16
     * Time: 7:17 PM
     */
    global $post_meta_data;
    $city = houzez_taxonomy_simple('property_city');
    $google_map_address = get_post_meta( get_the_ID(), 'fave_property_map_address', true );
    $google_map_address_url = "https://maps.google.com/?q=".$google_map_address;
    if( !empty($city) ) {
        
    ?>
    <div id="city" class="detail-city detail-block target-block">
            <div class="detail-title">
            		<h2 class="title-left"><?php esc_html_e( 'About', 'houzez' ); ?> 
            		    <?php
                    
                    	$terms = get_the_terms( $post->ID , 'property_city' ); 
                            foreach ( $terms as $term ) {
                            $term_link = get_term_link( $term, 'property_city' );
                            if( is_wp_error( $term_link ) )
                             continue;
                            echo '<a href="' . $term_link . '">' . $term->name . '</a>';
                            } 
                            
            			?>
            		
            		    <?php esc_html_e( 'City', 'houzez' ); ?>
            		</h2>
            		<?php if( !empty($google_map_address) ) { ?>
            		<div class="title-right">
            			<a target="_blank" href="<?php echo esc_url($google_map_address_url); ?>"><?php esc_html_e( 'Open on Google Maps', 'houzez' ); ?> <i class="fa fa-map-marker"></i></a>
            		</div>
            		<?php } ?>
            </div>
    		<div>
            <?php echo term_description( $term, 'property_city' ); ?>
    		</div>
    		<ul class="list-three-col">
                    <?php
                        if( !empty( $city ) ) {
                            echo '<strong>'.esc_html__('Property in', 'houzez').' '.esc_attr( $city ).'&nbsp:</strong>';
                        }
                        if( !empty( $city ) ) {
                            echo '<li><a href="' . esc_url( $term_link ) . '">' .esc_html__($term->count).' '.esc_html__('Properties Listed', 'houzez'). '</a></li>';
                        }
                    ?>
                </ul>
    		<div>
    		</div>
    
    <?php } ?>
    </div>

    I this code I am displaying city name in this Line : echo ‘‘ . $term->name . ‘‘;

    Which outputs city name : Patna

    And for discription I am using : echo term_description( $term, ‘property_city’ );

    which outputs about the city term discription which i have adeed in backend: A city in state of “Bihar” with an average population of 1,683,200. Find best of the best properties listed for rents or sell in “Patna” at Krieta Homes. We make property buying and renting hassle and stress free.

    Now below that i want to display the weather info of that city. how can i do that ?
    Please help.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Automatic city according to my theme’ is closed to new replies.