add_filter( 'the_title', 'YearOfMake', 10, 2 );
function YearOfMake( $title, $post_id )
{
if ( get_post_type( $post_id ) != 'product' && ! is_archive() )
return $title;
if ( ! ( is_shop() || is_product_category() || is_product_tag() ) )
return $title;
/*
global $product;
$attribute="year-made";
$abv = $product->get_attribute($attribute);
if(!empty($abv))
{
$title .= '<br /><p>' . $abv . '</p>';
}
*/
$terms = wp_get_post_terms( $post_id, 'product_tag' );
$term = reset( $terms );
if ( !empty( $term->name ))
{
$title .= '<br /><p>' . strtoupper( $term->name ) . '</p>';
}
return $title;
}
Related Posts:
- Use wc_enqueue_js only on specific pages – nested add_action
- How to Remove a Filter from the Admin List Table?
- Trying to place a custom field after the total section in the checkout page in woocommerce
- Woocommerce custom Plugin in wordpress [closed]
- Use PHP Class in WordPress functions
- How do I remove an action hook inside a class that is called by another class?
- How to add custom checkout field in user details mail template
- wordpress + woocommerce display product with additional information [closed]
- how to fix error “called incorrectly, should not be accessed directly”?
- Function works when I don’t login to WordPress but when I login then it doesn’t work
- How to auto fetch customer details in Woocommerce in checkout page
- Displaying custom taxonomy on WooCommerce product page
- Sum the total amount of a specific product purchased per user and display in table
- Change “add to cart” button color based on Woocommerce product category [closed]
- How can I get the values of my WordPress $wpdb query in Jquery?
- Adding widgets to my plugin page instead of WordPress dashboard
- How can I pass a custom/dynamic product to the Woocommerce cart?
- Add to cart function not working for first product when cart is empty [closed]
- I want to add custom add to cart link [closed]
- How to make products with no cost in WooCommerce
- Woocommerce : Can’t get product info in loop
- WooCommerce custom product dimensions
- Trouble checking if custom woocommerce checkout field is empty or not
- action theme mailchimp subscriber fields
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Validation algorithm in checkout field
- Adding function to Genesis genesis_header [closed]
- How do I remove the product thumbnail link from a specific div in Woocommerce? [closed]
- Modify custom field input data before creating a new post
- My new button is in the wrong place
- WordPress Woocommerce – Product Type [closed]
- Pagination for custom shop loop woocommerce
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- jQuery code not working when included in functions.php
- add_action taking an array with the 2nd argument?
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Should `wp_login` be used since it’s deprecated?
- Woocommerce change prices for a certain country [closed]
- How to get private property in parent class into extended class?
- How to show a users bio on a page
- Override a function defined in wp-includes/comment-template.php
- echo something inside a shortcode
- Nested “do” and “add” Actions is possible?
- Replace Woocommerce “add to cart” to be “Download” button [closed]
- Is there a way to hook or call a custom woocomerce template that is not part of the default templates of woocommerce?
- get taxonomy thumbnail and use it as a variable in code
- Woocommerce Email attachments not working – file not being attached
- Function returns text instead of html [closed]
- Change order of custom submenu link in WP Admin?
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Single Quotes in .php file doesn’t load website
- Add post with approval by the admin
- get_total () returns 0 – woocommerce [closed]
- How to remove coupon dropdown feature
- Woocommerce display one random product via php
- Change product_base programmatically
- How to catch wordpress post ID when it’s published
- WordPress redirect redirecting too many times or not at all
- Add html link in functions.php files of the theme
- require_once() if a product in woocommerce contains a tag [closed]
- How to optimize update_post_meta?
- How to upload WP user avatar on woocommerce account page [closed]
- Add product to cart for user – WC()->cart->add_to_cart [closed]
- Remove item in Checkout
- email alert for product availability
- How to relocate paypal button gateway on checkout page in woocommerce
- How to rename woocommerce-billing-fields
- Can a plugin redirect product page based on IF condition?
- Seo Friendly Filter URLs
- How to display SQL query that ran in WC_Order_Query?
- WooCommerce pages looks unstyled
- customize woocommerce templates and display store on home
- How to disable delivery on certain date at checkout page in WooCommerce?
- WC_Customer delete function returns error
- Only show size attributes in product box woocommerce when available
- How do I change this function from two returns to one string to show sku and dimensions in WooCommerce cart?
- Remove page title in product page using a function
- woocommerce specific quantities for product
- how can i add class or span tag at sprintf?
- Call WC_Product get_price()?
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- How to display a custom product field value of a specific category on a Woo Commerce checkout page?
- How to pass argument to add_action while the method is inside a class?
- Personalize checkout text
- CSS change in woo commerce Place Order Text [closed]
- Woocommerce – get_items() returns empty array
- How do I run code every 24 hours?
- Disable if there are no children – Woocommerce
- WooCommerce – Moving Product Price to the Left of Add to Cart Button [closed]
- Woocommerce Product_cat for current category page
- Exclude product attributes from taxonomy terms loop
- WP All Import / Update stock quantity from multiple XML files
- woocommerce related product title length
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- woocommerce wc_create_order(); is creating multiple orders instead of one?
- Create a package of products as one Item in woocommerce?
- Woocommerce: remove total sum from new order’s email [closed]
- Include js script ONLY on woocommerce product category pages? [closed]
- WP_Query multiple post results