Skip to content

Instantly share code, notes, and snippets.

@Dinamiko Dinamiko/dkpdf-wc-02.php
Last active Jan 23, 2016

Embed
What would you like to do?
<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
You can’t perform that action at this time.