BuddyDev

Search

[Resolved] Author Archive Page

  • Participant
    Level: Initiated
    Posts: 19
    Daniel Moore on #42345

    Hi Brajesh

    I am looking for a URL link that allows the current logged-in user to go to their author archive page.

    I tried things like ‘www.websiteurl.com/members/me/author’ but it didn’t work.

    Could you help please?

    Thank you
    Daniel

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #42349

    Hello Daniel,

    Thank you for posting. Please try ‘posts’ instead of ‘author’ and then give it a try. Please check the following screenshot

    https://www.awesomescreenshot.com/image/19430895?key=0371deab9a9791ca8033264aef9b8d99

    If not provided use ‘post’

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 19
    Daniel Moore on #42352
    This reply has been marked as private.
  • Participant
    Level: Initiated
    Posts: 19
    Daniel Moore on #42354

    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.

  • Participant
    Level: Initiated
    Posts: 19
    Daniel Moore on #42356

    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.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #42371

    Hello Daniel,

    Thank you for sharing the solution. I am glad that the problem is resolved on your own.

    Regards
    Ravi

The topic ‘ [Resolved] Author Archive Page’ is closed to new replies.

This topic is: resolved