Skip to content

Instantly share code, notes, and snippets.

@Dinamiko
Last active January 23, 2016 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dinamiko/44f6816df9bd97c105bc to your computer and use it in GitHub Desktop.
Save Dinamiko/44f6816df9bd97c105bc to your computer and use it in GitHub Desktop.
<body>
<?php
global $post;
$pdf = get_query_var( 'pdf' );
$post_type = get_post_type( $pdf );
if( $pdf ) {
// get info
$title = get_the_title();
if( has_post_thumbnail( $post->ID ) ) {
$thumbnail = get_the_post_thumbnail( $post->ID, 'medium' );
}
$description = get_the_excerpt();
$product = new WC_Product( $post->ID );
$currency = get_woocommerce_currency_symbol();
$regular_price = get_post_meta( $post->ID, '_regular_price');
$sale_price = get_post_meta( $post->ID, '_sale_price');
$link = get_the_permalink();
// print info
echo esc_attr( $title ).'<br>';
if( $thumbnail ) { echo $thumbnail; }
echo esc_html( $description ).'<br>';
echo esc_attr( $regular_price[0] ). $currency .'<br>';
if( $sale_price ) {
echo esc_attr( $sale_price[0] ). $currency .'<br>';
}
echo esc_url( $link ).'<br>';
}
?>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment