| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
/** |
| 4 |
* This template shows a print-friendly |
| 5 |
* version of a single listing page |
| 6 |
* |
| 7 |
* @package WPSight |
| 8 |
* @since 1.0.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
$listing_id = absint( $_GET['print'] ); |
| 12 |
$listing = get_post( $listing_id ); |
| 13 |
$status = get_post_status( $listing_id ); |
| 14 |
|
| 15 |
if ( 'publish' !== $status ) { |
| 16 |
$status_message = sprintf( |
| 17 |
/* translators: %s: Listing status. */ |
| 18 |
__( 'This listing is %s', 'wpcasa' ), |
| 19 |
(string) $status |
| 20 |
); |
| 21 |
|
| 22 |
echo '<h2>' . esc_html( $status_message ) . '</h2>'; |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
$listing_offer = wpsight_get_listing_offer( $listing->ID, false ); ?> |
| 27 |
<!DOCTYPE html> |
| 28 |
<html> |
| 29 |
|
| 30 |
<head> |
| 31 |
<title><?php echo esc_html( $listing->_listing_title ); ?></title> |
| 32 |
<?php do_action( 'wpsight_head_print' ); ?> |
| 33 |
</head> |
| 34 |
|
| 35 |
<body class="print<?php if( is_rtl() ) echo esc_attr( ' rtl' ); ?>"> |
| 36 |
|
| 37 |
<div class="actions clearfix"> |
| 38 |
|
| 39 |
<div class="alignleft"> |
| 40 |
<a href="<?php echo esc_url( get_permalink( $listing->ID ) ); ?>" class="button back">« <?php echo esc_html_x( 'Back to Listing', 'listing print', 'wpcasa' ); ?></a> |
| 41 |
</div> |
| 42 |
|
| 43 |
<div class="alignright"> |
| 44 |
<a href="#" onclick="window.print();return false" class="button printnow"><?php echo esc_html_x( 'Print Now', 'listing print', 'wpcasa' ); ?></a> |
| 45 |
</div> |
| 46 |
|
| 47 |
</div><!-- .actions --> |
| 48 |
|
| 49 |
<page size="A4"> |
| 50 |
|
| 51 |
<div class="wrap"> |
| 52 |
|
| 53 |
<div class="listing-print-title"> |
| 54 |
<h1><?php echo esc_html( get_the_title( $listing ) ); ?></h1> |
| 55 |
</div><!-- .listing-print-title --> |
| 56 |
|
| 57 |
<div class="listing-print-info clearfix"> |
| 58 |
<div class="alignleft"> |
| 59 |
<?php wpsight_listing_price( $listing->ID ); ?> |
| 60 |
</div> |
| 61 |
<div class="alignright"> |
| 62 |
<?php wpsight_listing_id( $listing->ID ); ?> - <?php wpsight_listing_offer( $listing->ID ); ?> |
| 63 |
</div> |
| 64 |
</div><!-- .listing-print-info --> |
| 65 |
|
| 66 |
<div class="listing-print-image"> |
| 67 |
<?php wpsight_listing_thumbnail( $listing->ID, 'full' ); ?> |
| 68 |
</div><!-- .listing-print-image --> |
| 69 |
|
| 70 |
<div class="listing-print-details"> |
| 71 |
<?php wpsight_listing_details( $listing->ID ); ?> |
| 72 |
</div><!-- .listing-print-details --> |
| 73 |
|
| 74 |
<div class="listing-print-description"> |
| 75 |
<?php if( wpsight_is_listing_not_available() ) : ?> |
| 76 |
<div class="wpsight-alert wpsight-alert-small wpsight-alert-not-available"> |
| 77 |
<?php echo esc_html( apply_filters( 'wpsight_listing_text_not_available', __( 'This property is currently not available.', 'wpcasa' ) ) ); ?> |
| 78 |
</div> |
| 79 |
<?php endif; ?> |
| 80 |
<div class="wpsight-listing-description" itemprop="description"> |
| 81 |
<?php echo wp_kses_post( apply_filters( 'wpsight_listing_description', wpsight_format_content( $listing->post_content ) ) ); ?> |
| 82 |
</div> |
| 83 |
</div><!-- .listing-print-description --> |
| 84 |
|
| 85 |
<?php if( wpsight_get_option( 'energy_efficiency_print' ) ) : ?> |
| 86 |
<div class="listing-print-energy-efficiency"> |
| 87 |
<?php echo do_shortcode( '[wpsight_listing_energy_efficiency orientation="horizontal"]' ); ?> |
| 88 |
</div><!-- .listing-print-energy-efficiency --> |
| 89 |
<?php endif; ?> |
| 90 |
|
| 91 |
<div class="listing-print-features"> |
| 92 |
<?php wpsight_listing_terms( 'feature', $listing->ID, ', ' ); ?> |
| 93 |
</div><!-- .listing-print-features --> |
| 94 |
|
| 95 |
<div class="listing-print-agent clearfix"> |
| 96 |
<div class="alignleft"> |
| 97 |
<?php wpsight_listing_agent_image( $listing->ID, array( 50, 50 ) ); ?> |
| 98 |
<?php wpsight_listing_agent_name( $listing->ID ); ?> |
| 99 |
<?php if( wpsight_get_listing_agent_company( $listing->ID ) ) : ?> |
| 100 |
<span class="wpsight-listing-agent-company">(<?php wpsight_listing_agent_company( $listing->ID ); ?>)</span> |
| 101 |
<?php endif; ?> |
| 102 |
<?php if( wpsight_get_listing_agent_phone( $listing->ID ) ) : ?> |
| 103 |
<br /><strong><?php wpsight_listing_agent_phone( $listing->ID ); ?></strong> |
| 104 |
<?php endif; ?> |
| 105 |
</div> |
| 106 |
<div class="alignright"> |
| 107 |
<img src="<?php echo esc_url( 'https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=' . urlencode( get_permalink( $listing->ID ) ) ); ?>" width="100" height="100" alt="" /> |
| 108 |
</div> |
| 109 |
</div><!-- .listing-print-agent --> |
| 110 |
|
| 111 |
</div><!-- .wrap --> |
| 112 |
|
| 113 |
</page> |
| 114 |
|
| 115 |
</body> |
| 116 |
</html> |
| 117 |
|