Replies
Thanks for your help guys but I found the solution 🙂
Just incase anyone may need it in the future:
Note: Before copy pasting, don’t forget to change somePrefix with any other prefix to avoid conflict with any other shortcodes.
Step 1: Make sure you have this filter in functions.php (If not, copy paste it there)
add_filter(‘wp_nav_menu_items’, ‘do_shortcode’);
Step 2: Use this snippet to return Author URL. Paste this in functions.php
add_shortcode( ‘somePrefix_author_url’, function() {
$author_link = get_author_posts_url( get_current_user_id() ); // original link
$without_protocol = trim( str_replace( array( ‘http://’, ‘https://’ ), ”, $author_link ), ‘/’ );
return $without_protocol; // returns author link without protocol});
Step 3: Go to Navigation Menu and add Custom Menu Link and use [somePrefix_author_url] in the URL field and ‘My personal page’ or something in the Name field.
Step 4: Test the link from the front-end if it works.
For clarification, I am trying to find a URL that I can use as a custom link in the menu, to link each logged-in user to their author page.
Ok, thanks buddy
I appreciate your expertise on these things.
Regards
DanielHi Brajesh
Could you recommend a follow user plugin that could achieve the same result?
Thanks
DanielHmm I am having difficulties with this.
It is showing the button on the single post, however, nothing happens when the button is clicked.
However, I am trying to put a follow button at the top of the author archive page. How could I do this? Is there a plugin with a button that makes this easy?
Thanks, your help is greatly appreciated.
Daniel
Hi Brajesh
Currently, I just use BuddyBoss ‘follow’ on a user’s profile. I don’t have a plunging for this.
Regards
Daniel