I am working on a site where I am using a plugin called Favorite Posts so logged-in users can add a post (a custom post type) to their favorites.
I created a page called my-favoritesmy-favorites
which allows the logged-in user to see the posts he has favorited.
Now I need to create a page which allows the another user or visitor to check this user's favorites.
So I need to be able to do three things:
getGet a function related to author that returns a link like mydomain.com/user/username
example.com/user/username
which I can append to /favorites to get the link - mydomain.com/user/username/favorites (the_author_linkexample.com/user/username/favorites
()the_author_link()
and get_the_author()get_the_author()
link seems to link to the website and the_author_posts_urlthe_author_posts_url()
outputs the a tag with the name. any function to just get the url or maybe modify author to show user instead?)get wordpressGet WordPress to use a template called favorites.php
favorites.php
to display this page. (ifIf the structure matches, then how do iI tell wordpressWordPress which template toto use?)getGet the user id of the user in order to show his/her favorites to the visitor. rightRight now i, I use the [favorite-post]
[favorite-post]
shortcode in my template file and can pass a parameter called [favorite-post user_id = ""].[favorite-post user_id = ""]
Will it automatically get the user id if the page is branched out from /author ?
I found this article but it still deals with custom post types and query_varsquery_vars
which I am not using. How do I make it work for the favorites page? Most other similar questions asked here were solved using a slug for the custom post type or taxonomy.