This code snippet should give the general idea:
<?php
// code goes in functions.php for your child theme
add_filter ('woocommerce_attribute', 'link_attributes');
function link_attributes($att_string) {
$atts = explode (',', $att_string);
$att_string = '';
foreach ($atts as $att) {
if (strlen($att_string) > 0) {
$att_string .= ', ';
}
$att = trim($att);
$att_string .= '<a href="https://wordpress.org/">'.$att.'</a>';
}
return $att_string;
}
Hi lorro,
Should I put it in an specific section of functions.php?
Thank you! I don’t know a lot about php. But should I do that with each attribute? Instead of https://wordpress.org put the url of the attribute?
Thank you!
You can put it anywhere in functions.php, though not inside a function. The “<?php” is only needed at the top.
What is the url for an attribute? Do you have an example please?
Thanks!
I have a comic shop so the first url is for the format (comic, trade paperback), second url is for preorders, stock and backorders. Both urls have a selected term. (trade paperback and preorder, respectively)
http://landascomics.com/tienda/?filter_formato=33
or
http://landascomics.com/tienda/?filter_stock=17
http://pastebin.com/aqYrzXYT
Works for me, your experience may vary.