Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8814481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:08:02+00:00 2026-06-14T04:08:02+00:00

I would like to add to my theme some links so that if a

  • 0

I would like to add to my theme some links so that if a user is logged in, he may go to his own page which lists his own comments and posts.

I have found several functions to help me create the template parts. For example:

How to display logged in users comments (only) on WordPress

Comment Author Link on WordPress

The problem is that I cannot find any information on creating the link. It seems like all of the functions for the_author do not accept an ID, such as current user ID. i would like to know how to create links outside the loop, to retrieve a template part, such as current user’s comments and posts. Can I create a new _link() function? A search of the codex for _link() isn’t returning what I need.

So far I managed to return the actual post titles, but I want a link at the top of my page that says “My Recent Activity”, something like that.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:08:04+00:00Added an answer on June 14, 2026 at 4:08 am

    Could you not create a page template called something like user activity. Then query the logged in user’s username and use the functions you found to return their comments? So the link would be the same for every user. The page itself would do all the magic by querying based on their username. Here’s some code I used to just retrieve recents comments on a home page:

    <?php
    
    $recent_comments = get_comments( array(
    'number'    => 2,
    'status'    => 'approve'
    ) );
    echo '<ul>';
    foreach($recent_comments as $c){
        $the_comment = mb_strimwidth($c->comment_content, 0, 80, "...", "UTF-8");
        echo '<li>';
            echo '<p>'.$the_comment.'</p>';
            echo '<span class="comment-source">'.$c->comment_author.'</span>';
            echo '<span class="time-ago">'.$c->comment_date_gmt.'</span>';
            $permalink = get_permalink( $c->comment_post_ID );
            echo '<a href="'.$permalink.'" class="post-link">'.$permalink.'</a>';
        echo '<l/i>';
    }
    echo '</ul>';
    ?>
    

    So you can use the parameter “post_author” to query the current user’s comments. And use get_currentuserinfo() to get the current user’s info.

    Hope that’s what you’re after!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have own project and i would like add for this class same as
I would like to add a custom calculation method to a managed object (which
I have some forms and I would like to add classes to the elements.
I have a ListView and each item have a TextView. I would like add
I would like to add a GestureDetector to all views (view groups) of an
I would like to add roots to a VirtualTreeView http://www.delphi-gems.com/index.php/controls/virtual-treeview with a thread like
I would like to add a hash into an array using Ruby version 1.8.7:
I would like to add up the number of line changes in an SVN
I would like to add a pop effect when I hover over a SVG
I would like to add a small dice-rolling effect to my Javascript code. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.