New link type
-
Is there any chance that a new link type can be created that will interact with Woo Commerce? For example, Authors List is being used to show post authors, but on my site post authors may also have products. Could a “product link” be created, that allows you to view all of an authors products where the products are tagged with the authors name?
-
Hi @ante1974
I’m not aware of WooCommerce having pages that list the products of a specific author, I might be wrong.
Is it part of WooCommerce or do you use some extension for that?
And can you send over an URL to one of those pages on your site that list products for a specific author only?
Hi @wpkube
Yes you are right, WooCommerce doesn’t list products of a specific author, but what I have done is made each WordPress User and author, given them “authorship” of their products as well as tagging their products with their name. So really it is a link to a specific tag:
Hi @ante1974
You could so something like this:
[authors_list after_bio='<a href="{al:user_url}">View Products</a>']So it shows a link to the author’s URL. It’s set when you go to edit a user, the “Website” field just above the “Biographical info”.
So for that URL you can set the URL to their products listing page.
Hi @wpkube
True I could do that, but I think I might want to link out to authors own websites too for SEO.
I just checked this page in Codex: https://codex.wordpress.org/Author_Templates
So it can be done by http://www.yoursite.co.uk/tag/firstname-lastname/ – which looks like it is http://www.yoursite.co.uk/tag/<?php echo $curauth->display_name; ?>/
To link direct to the author pages in WordPress speak it would be: https://www.yoursite.co.uk/author/<?php echo $curauth->display_name; ?>/ – but that only shows posts not products.
I guess all I am really asking for, if it is possible is to link to a tag of the authors display name.
Display names are based on the first name and last name. It’s the same text you get as the author’s name in the list from our plugin. It’s definitely not in the format
firstname-lastnameYou can use any of the available user meta you want. The example I sent over uses the “Website” field value.
You could use the Advanced Custom Fields plugin to add a new field for the users.
So you add a new text field with the ID
product_archive_urland for the “Location” you set “User Form”. That field will then show when editing a user.To output the value of that field in the authors list you would use:
[authors_list after_bio='<a href="{al:product_archive_url}">View Products</a>']-
This reply was modified 4 years, 7 months ago by
WPKube.
@wpkube ok thanks let me try that I have ACF installed.
Hi @ante1974
You’re welcome. Did it work out?
@wpkube actually I have one more question on this. I am using Authors List style 2, with a custom link on View Profile.
[authors_list after_bio='<a href="{al:user_url}">View Profile</a>']The custom link on “view profile” is different from the “wrap around link” that links the entire author image. Is there a way to make the the “wrap around link” link the same as my “view profile” link?
Hi @ante1974
There’s a parameter called
link_towhich can be used to change what the wrapper links to. One of the values ismeta(user meta value) and then you use the parameterlink_to_meta_keyto set the field key/id:[authors_list link_to="meta" link_to_meta_key="user_url" after_bio='<a href="{al:user_url}">View Profile</a>']You’re welcome, happy to hear it worked out.
-
This reply was modified 4 years, 7 months ago by
The topic ‘New link type’ is closed to new replies.