Advertisement
Guest User

Classifieds

a guest
Dec 7th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.87 KB | None | 0 0
  1. <?php get_header(); ?>
  2. <div id="main">
  3. <?php
  4. /**
  5. * The Template for displaying all single classifieds posts.
  6. * You can override this file in your active theme.
  7. *
  8. * @package Classifieds
  9. * @subpackage UI Front
  10. * @since Classifieds 2.0
  11. */
  12.  
  13. global $post, $wp_query;
  14. $options = $this->get_options( 'general' );
  15. $field_image = (empty($options['field_image_def'])) ? $this->plugin_url . 'ui-front/general/images/blank.gif' : $options['field_image_def'];
  16.  
  17. /**
  18. * $content is already filled with the database html.
  19. * This template just adds classifieds specfic code around it.
  20. */
  21. ?>
  22.  
  23. <script type="text/javascript" src="<?php echo $this->plugin_url . 'ui-front/js/ui-front.js'; ?>" >
  24. </script>
  25.  
  26. <?php if ( isset( $_POST['_wpnonce'] ) ): ?>
  27. <br clear="all" />
  28. <div id="cf-message-error">
  29. <?php _e( "Send message failed: you didn't fill all required fields correctly in contact form!", $this->text_domain ); ?>
  30. </div>
  31. <br clear="all" />
  32. <?php elseif ( isset( $_GET['sent'] ) && 1 == $_GET['sent'] ): ?>
  33. <br clear="all" />
  34. <div id="cf-message">
  35. <?php _e( 'Message is sent!', $this->text_domain ); ?>
  36. </div>
  37. <br clear="all" />
  38. <?php endif; ?>
  39.  
  40. <div id="main">
  41. <div class="cf-post">
  42.  
  43. <div class="cf-image">
  44. <?php
  45. if(has_post_thumbnail()){
  46. $thumbnail = get_the_post_thumbnail( $post->ID, array( 300, 300 ) );
  47. } else {
  48. $thumbnail = '<img width="300" height="300" title="no image" alt="no image" class="cf-no-image wp-post-image" src="' . $field_image . '">';
  49. }
  50. ?>
  51. <a href="<?php the_permalink(); ?>" ><?php echo $thumbnail; ?></a>
  52. </div>
  53. <div class="clear"></div>
  54. <div class="cf-ad-info">
  55. <table>
  56. <tr>
  57. <th><?php _e( 'Posted By', $this->text_domain ); ?></th>
  58. <td>
  59.  
  60. <?php
  61. /* For BuddyPress compatibility */
  62. if ( isset( $bp ) ):?>
  63. <a href="<?php echo bp_core_get_user_domain( get_the_author_meta('ID') ) . 'classifieds/';?>" alt="<?php the_author(); ?> Profile" ><?php echo $user->display_name; ?></a>
  64. <?php else: ?>
  65.  
  66. <?php the_author_posts_link(); ?>
  67.  
  68. <?php endif; ?>
  69.  
  70.  
  71. </td>
  72. </tr>
  73. <tr>
  74. <th><?php _e( 'Categories', $this->text_domain ); ?></th>
  75. <td>
  76. <?php $taxonomies = get_object_taxonomies( 'classifieds', 'names' ); ?>
  77. <?php foreach ( $taxonomies as $taxonomy ): ?>
  78. <?php echo get_the_term_list( $post->ID, $taxonomy, '', ', ', '' ) . ' '; ?>
  79. <?php endforeach; ?>
  80. </td>
  81. </tr>
  82. <tr>
  83. <th><?php _e( 'Posted On', $this->text_domain ); ?></th>
  84. <td><?php the_date(); ?></td>
  85. </tr>
  86. <tr>
  87. <th><?php _e( 'Expires On', $this->text_domain ); ?></th>
  88. <td><?php if ( class_exists('Classifieds_Core') ) echo Classifieds_Core::get_expiration_date( get_the_ID() ); ?></td>
  89. </tr>
  90. </table>
  91. <div class="clear"></div>
  92. <div class="cf-custom-block">
  93.  
  94. <?php
  95. //filter the duration field from the output
  96. add_filter('custom_field_filter', array(&$this, 'hide_duration') );
  97. echo do_shortcode('[custom_fields_block wrap="table"][/custom_fields_block]');
  98. remove_filter('custom_field_filter', array(&$this, 'hide_duration') );
  99. ?>
  100. </div>
  101. </div>
  102. <div class="clear"></div>
  103.  
  104. <form method="post" action="#" class="contact-user-btn action-form" id="action-form">
  105. <input type="submit" name="contact_user" value="<?php _e('Contact User', $this->text_domain ); ?>" onclick="classifieds.toggle_contact_form(); return false;" />
  106. </form>
  107. <div class="clear"></div>
  108.  
  109. <form method="post" action="#" class="standard-form base cf-contact-form" id="confirm-form">
  110. <?php
  111. global $current_user;
  112.  
  113. $name = ( isset( $current_user->display_name ) && '' != $current_user->display_name ) ? $current_user->display_name :
  114. ( ( isset( $current_user->first_name ) && '' != $current_user->first_name ) ? $current_user->first_name : '' );
  115. $email = ( isset( $current_user->user_email ) && '' != $current_user->user_email ) ? $current_user->user_email : '';
  116. ?>
  117. <div class="editfield">
  118. <label for="name"><?php _e( 'Name', $this->text_domain ); ?> <span style="color:#F00"><?php _e( '*', $this->text_domain ); ?></span></label><input type="text" id="name" name ="name" value="<?php echo ( isset( $_POST['name'] ) ) ? $_POST['name'] : $name; ?>" />
  119. <p class="description"><?php _e( 'Enter your full name here.', $this->text_domain ); ?></p>
  120. </div>
  121. <div class="editfield">
  122. <label for="email"><?php _e( 'Email', $this->text_domain ); ?> <span style="color:#F00"><?php _e( '*', $this->text_domain ); ?></span></label><input type="text" id="email" name ="email" value="<?php echo ( isset( $_POST['email'] ) ) ? $_POST['email'] : $email; ?>" />
  123. <p class="description"><?php _e( 'Enter a valid email address here.', $this->text_domain ); ?></p>
  124. </div>
  125. <div class="editfield">
  126. <label for="subject"><?php _e( 'Subject', $this->text_domain ); ?> <span style="color:#F00"><?php _e( '*', $this->text_domain ); ?></span></label><input type="text" id="subject" name ="subject" value="<?php echo ( isset( $_POST['subject'] ) ) ? $_POST['subject'] : ''; ?>" />
  127. <p class="description"><?php _e( 'Enter the subject of your inquire here.', $this->text_domain ); ?></p>
  128. </div>
  129. <div class="editfield">
  130. <label for="message"><?php _e( 'Message', $this->text_domain ); ?> <span style="color:#F00"><?php _e( '*', $this->text_domain ); ?></span></label><textarea id="message" name="message"><?php echo ( isset( $_POST['message'] ) ) ? $_POST['message'] : ''; ?></textarea>
  131. <p class="description"><?php _e( 'Enter the content of your inquire here.', $this->text_domain ); ?></p>
  132. </div>
  133.  
  134. <div class="editfield">
  135. <label for="cf_random_value"><?php _e( 'Security image', $this->text_domain ); ?> <span style="color:#F00"><?php _e( '*', $this->text_domain ); ?></span></label><img class="captcha" src="<?php echo $this->plugin_url; ?>ui-front/general/cf-captcha-image.php" />
  136. <input type="text" id="cf_random_value" name ="cf_random_value" value="" size="8" />
  137. <p class="description"><?php _e( 'Enter the characters from the image.', $this->text_domain ); ?></p>
  138. </div>
  139.  
  140. <div class="submit">
  141. <p>
  142. <?php wp_nonce_field( 'send_message' ); ?>
  143. <input type="submit" class="button confirm" value="<?php _e( 'Send', $this->text_domain ); ?>" name="contact_form_send" /><input type="submit" class="button cancel" value="<?php _e( 'Cancel', $this->text_domain ); ?>" onclick="classifieds.cancel_contact_form(); return false;" />
  144. </p>
  145. </div>
  146.  
  147. </form>
  148.  
  149. <div class="clear"></div>
  150.  
  151. <table class="cf-description">
  152. <thead>
  153. <tr>
  154. <th><?php _e( 'Description', $this->text_domain ); ?></th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. <tr>
  159. <td>
  160. <?php
  161. //$content is already filled with the database text. This just add classified specfic code around it.
  162. echo $content;
  163. ?>
  164. </td>
  165. </tr>
  166. </tbody>
  167. </table>
  168. </div>
  169.  
  170. </div><!--#main-->
  171.  
  172. <?php get_sidebar('blog'); ?>
  173.  
  174. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement