<h3><a href="<?php 
        the_permalink();
        ?>
/<?php 
        echo $post_name;
        ?>
"><?php 
        echo $title;
        ?>
</a></h3>

					<div class="clr"></div>
                    <p><?php 
        cp_get_ad_details($id, $cat_id);
        ?>
</p>
				</div>
                <?php 
        $sql = "SELECT MAX(horseshows.show_date_time) AS 'recentdate',horseshows.id,horseshows.city,horseshows.state FROM horseshows LEFT JOIN horseshows_meta ON horseshows.id=horseshows_meta.show_id WHERE horseshows_meta.post_id='{$id}'";
        $details = $wpdb->get_results($sql);
        $recentdate = $details[0]->recentdate;
        $sql1 = "SELECT id,name_show,city,state FROM horseshows WHERE show_date_time='{$recentdate}'";
        $details1 = $wpdb->get_results($sql1);
        ?>
                <div style="width: 28%; float: right; padding: 10px 0;"><p style="text-align: right;">Next Show:<span style="font-weight:bold;"><?php 
        if (!empty($details[0]->id)) {
            echo $details[0]->recentdate . '</br>' . $details1[0]->city . ',' . $details1[0]->state;
        } else {
            echo "not added in show";
                                <?php 
        }
        ?>

				                <div class="clr"></div>

				                <?php 
        appthemes_before_post_content();
        ?>

                                <div class="single-main">

                                    <?php 
        // 3.0+ display text areas in content area before content.
        cp_get_ad_details($post->ID, $cat_id, 'content');
        ?>

                                    <h3 class="description-area"><?php 
        _e('Description', 'appthemes');
        ?>
</h3>

                                    <?php 
        the_content();
        ?>

                                </div>

                                <?php 
        appthemes_after_post_content();
</span></p>
                        <p><span><?php 
            echo $result->address;
            ?>
</span></p>
                        <p><span><?php 
            echo $result->city;
            ?>
</span></p>
                        <p><span><?php 
            echo $result->state;
            ?>
</span></p>
                        
                        <p><?php 
            cp_get_ad_details($post->ID, $cat_id);
            ?>
</p>
                    </div>
                             
                    <div class="post-right_icons horseshow_show">
                    	<span title="Add Horse"  class="addhorses addhorsetoshow pop" style="float:left;padding:15px;" show="<?php 
            echo $result->id;
            ?>
" check="<?php 
            if (is_user_logged_in()) {
                echo "login";
            }
            ?>
" onclick="selectValue(id=<?php 
            echo $result->id;