6
6
666Wolf6662015-11-16 16:00:57
WordPress
666Wolf666, 2015-11-16 16:00:57

How to display a specific block in a specific woocommerce product category?

<?php
/**
 * Single Product Price, including microdata for SEO
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */

if ( ! defined( 'ABSPATH' ) ) {
  exit; // Exit if accessed directly
}

global $product;

?>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">

  <p class="price"><?php echo $product->get_price_html(); ?></p>
  
  <div id="zakazat"><a href="#">Кнопка на правила заказа</a></div> /*Вот этот блок мне нужно вывести на страницах определенной категории, сразу после цены.*/
  
  <meta itemprop="price" content="<?php echo $product->get_price(); ?>" />
  <meta itemprop="priceCurrency" content="<?php echo get_woocommerce_currency(); ?>" />
  <link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />

</div>

I did it with css, I just hid the block on unnecessary pages. But the page is also cluttered with woocommerce started working not so long ago... What code should I add or what function should I use? Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mr_dev1l, 2015-11-16
@mr_dev1l

Answer here

6
666Wolf666, 2015-11-17
@666Wolf666

<?php if ( in_category(47) ): ?>
  <div><a href="#">Кнопка на правила заказа</a></div>
<?php endif; ?>

But nothing happens at all. Tried and output using this in function.php:
$cat_n = 47;
if ( in_category($cat_n) ) {
include(TEMPLATEPATH . '/beidj.php');}

Tell me what could be the problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question