• Hi,
    I have a real estate portal in which i have city, I have displayed city info on property page, and now i want to add weather information below that page in template file. so on every property page it gets property city and display that cities weather conditions.

    I was able to produce the city outside with code but it shows the city at front end but not working if i add inside your shortcode. and if i manualy insert city then its displaying fine. but i need to automate this to property city, how can i do that. I am using below codes in my theme. here is the link of my website. you can see any property page.

    https://www.krieta.com

    code i am using :

    <?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 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>
    		<h4 class="title-left"><?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>';
                    } 
                    
    			?>
            
    		</h4>
    		</div>
    		
    		<div><?php echo term_description( $term, 'property_city' ) ?></div>
            <div><?php echo do_shortcode( '[awesome-weather location=”<?php echo $term->name ?>” locale=”in”]' ); ?></div>
            <?php echo $term->name ?>, IN
    <?php } ?>
    </div>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter vinay404

    (@vinay404)

    Hi, I shorted it out it started working by doing a simple edit in code. whil copying your shortcode from this site it copied something wrong.Earlier it was :

    [awesome-weather location=”<?php echo $term->name ?>” locale=”in”]`

    But it should be like this:
    [awesome-weather location="<?php echo $term->name ?>" locale=”in”]

    If look closer you will find the diffrence in both code.

    I have posted it for someone might get in this kind of problem.
    Thanks regards.

    Thread Starter vinay404

    (@vinay404)

    hey its nt working its showing default city to everypage timberlake park. please help

    Thread Starter vinay404

    (@vinay404)

    Can anyone please reply me ?

    Thread Starter vinay404

    (@vinay404)

    ok, i am uninstalling tghe plugin, thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘phpcode inside your shortcode, for automatic city update’ is closed to new replies.