jrothra

WooCommerce title.php Customization

Mar 19th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Single Product title
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/single-product/title.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
  8.  * will need to copy the new files to your theme to maintain compatibility. We try to do this.
  9.  * as little as possible, but it does happen. When this occurs the version of the template file will.
  10.  * be bumped and the readme will list any important changes.
  11.  *
  12.  * @see         http://docs.woothemes.com/document/template-structure/
  13.  * @author  WooThemes
  14.  * @package WooCommerce/Templates
  15.  * @version 1.6.4
  16.  */
  17.  
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit; // Exit if accessed directly
  20. }
  21.  
  22. ?>
  23. <h1 itemprop="name" class="product_title entry-title"><?php the_title(); ?></h1>
  24. <?php
  25. global $product;
  26.   $attributes = $product->get_attributes();
  27.   foreach ($attributes as $attribute) {
  28.     if ($attribute["name"] == "Product author") {
  29.       $values = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
  30.       echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
  31.     }
  32.   }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment