<?php 
if ($article) {
    $image_size = 'medium';
    if (isset($type) && $type == 'category') {
        $img = z_taxonomy_image_url($article->term_id);
        $title = $article->cat_name;
        $link = get_category_link($article->term_id);
        $price = array();
        $dimension = '';
    } else {
        $img = get_post_featured_image_url($article->ID, $image_size);
        $title = $article->post_title;
        $link = get_permalink($article->ID);
        $price = get_price($article->ID);
        $main_category = get_post_main_category_slug($article);
        $dimension = get_product_dimension($article, $main_category);
    }
    // $img = 'http://placehold.it/350x250';
    ?>
    
    <header>
      <h3><a href="<?php 
    echo $link;
    ?>
" title="<?php 
    echo $title;
    ?>
"><?php 
    echo $title;
    ?>
</a></h3>
Exemple #2
0
           }
       }
   } else {
       include '_not-found.php';
   }
   ?>
 </section>
 
 <?php 
   if (is_single()) {
       // Get similar posts
       // Get product's main category
       $main_category = get_post_main_category_slug($post);
       $parent_slug = $main_category;
       // Get product dimensions from meta fields / filters
       $dimension = get_product_dimension($post, $main_category);
       if ($dimension != '') {
           $articles = get_similar_posts($post, $main_category, $dimension);
           $title = 'Alte variante pt. ' . $dimension;
           $link = null;
           $id = 'variations';
           include '_articles.php';
       }
       // If there are no similar posts then get related posts
       if (empty($articles)) {
           $articles = MRP_get_related_posts($post_id, true);
           $title = 'Articole similare';
           $link = null;
           $id = 'related';
           include '_articles.php';
       }