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
- Woocommerce get selected shipping zone id for the current user
- Getting the action’s tag name within the action
- Action ‘save_post’ not working for quick edit
- Can i check if user is doing any ajax request?
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- How to show order data by multiple ID?
- Insert post without actions/hooks
- Problem with Woocommerce REST API Authentication
- Remove General Tab and Plugin Tab in Settings in Woocommerce
- WooCommerce – Display variation custom field value [closed]
- Woocommerce HTML email option unavailable
- How to add SVG icon above product tab title
- How to change / delete product short description in Woocommerce
- How to trash multiple post/product programmatically
- action hook wp_head higher priority as all other plugins/hooks
- OrderItem get_total() returns lower value than $order_item->get_product()->get_price() * quantity
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- WooCommerce – Reset quantity input field when variation changes
- Custom Text in WooCommerce Order Processing Email Based on Products
- woocommerce subscriptions – get expiration date [closed]
- Automatically remove a canceled order in Woocommerce
- How to pass arguments to add_action() or retrieve return value of called function?
- Woocommerce hook run after an Order been created through REST API
- How can I apply_filters from inside a function?
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Different Minimum Order Amounts based on Shipping Zone [closed]
- Displaying Woocommerce Product Category in WordPress
- Displaying custom taxonomy on WooCommerce product page
- Change “add to cart” button color based on Woocommerce product category [closed]
- Add to cart function not working for first product when cart is empty [closed]
- Woocommerce : Can’t get product info in loop
- WooCommerce custom product dimensions
- action theme mailchimp subscriber fields
- 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
- Single Quotes in .php file doesn’t load website
- get_total () returns 0 – woocommerce [closed]
- How to catch wordpress post ID when it’s published
- How to upload WP user avatar on woocommerce account page [closed]
- How to relocate paypal button gateway on checkout page in woocommerce
- How to rename woocommerce-billing-fields
- Only show size attributes in product box woocommerce when available
- Disable if there are no children – Woocommerce
- Create a package of products as one Item in woocommerce?
- fetch woocommerce product with custom taxonomy
- Action Hook Inside WordPress Plugin Shortcode
- After disabling WPML multi currency, the currency is still handled by the WPML
- How can i programmatically change the SKU of a product based on product variation?
- Execute PHP code only with specific user role
- Add a custom WooCommerce settings tab with sections
- Checking page before applying image restrictions while uploading
- WordPress Fresh Install Errors (Woocommerce specifically now)
- Generate images with html2canvas and the woocommerce api
- Woocommerce – Exclude variation attribute on specific variation
- PHP function for horizontal Woocommerce thumbnails and badges
- Set ACF on order during checkout
- Hide payment method based on user role AND minimum cart value
- WooCommerce display price before add to cart [closed]
- Get the same SKU from woocommerce itself for simple and variable products
- How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?
- Woocommerce checkout page – custom field checkbox value into email
- WooCommerce function not working correctly after moving from the functions.php into a class
- Filter for product subcategory listing page load
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- WooCommerce – template_redirect if is_checkout AND order has been paid?
- AJAX to add to cart multiple products woocommerce
- Make WooCommerce product categories only show images on homepage
- ACF under category name in shop page [closed]
- add_action in wp_head accessible from class
- WooCommerce Quantity in Dropdown menu instead of clasic [closed]
- WP_Query To Display Product Of Brand On Taxonomy Page
- Hot to edit WooCOmmerce dashboard?
- WooCommerce subcategories help
- WooCommerce multiple custom fields code
- Search function not working
- loop to return tags in woocommerce in alphabetical order?
- wordpress form action page not found
- How to have more than one ID included in the exclude command?
- I was wondering if it’s possible to implement card.js on WordPress
- wp_query beginner
- Woocommerce custom field on emails outputs ‘Array’
- WordPress using get_term to retreive slug not working as expected
- Can’t make product images clickable
- WooCommerce – Print Processing orders [closed]
- Hide cart when empty [closed]
- How does add_action ‘comment_post’ work?
- WooCommerce Custom Pagination
- Order woo products, but first products must be with acf fields
- Warning: Attempt to read property “term_id” on int – Woocommerce
- Find owner of coupon
- Add Woocommerce Customers link to custom admin menu
- PayPal button not showing and cannot retrieve order error in PayPal