WordPress.org

Ready to get started?Download WordPress

Forums

adding " my posts " in menu (6 posts)

  1. Reza Shadpay
    Member
    Posted 2 years ago #

    Hello everybody

    I want to add " my posts " to main menu.
    by clicking on this, each logged-in user will see his/her own posts.

    I don't know how the link structure should be to add on the menu.

    Thanks

  2. Aaron
    Member
    Posted 2 years ago #

    Hope you understand this. :)

    For the menu item you will need to add a condition to see if they are logged in. You dont want to show the link to their posts if they arent.

    So it would be something like.

    <?php
    if ( is_user_logged_in() ) {
        CODE WILL GO HERE
    } ?>

    Now your link you will want to post can be an author.php or any template you want to use and will contain a function to call all the posts from the author.

    <?php the_author_posts_link(); ?>

    Sorry for not doing it step by step but this is a general idea on how to do it.

  3. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    the author link

    The link structure for an 'author' posts is
    //http://yoursite.com/author/authorname/ (using permalinks)

    If each user makes each post private only the authors and those with higher roles can see them.

    From this Codex article:

    Publish box Visibility - This determines how your post appears to the world. Public posts will be visible by all website visitors once published. Password Protected posts are published to all, but visitors must know the password to view the post content. Private posts are visible only to you (and to other editors or admins within your site)

  4. Reza Shadpay
    Member
    Posted 2 years ago #

    WP Bum, thanks, but I want add to menu (link structure)
    SwansonPhotos, you got what I want. I did it but I faced error 400, any idea?

  5. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    What did you do?

  6. Reza Shadpay
    Member
    Posted 2 years ago #

    I added same link you mentioned: http://mysite.com/author/%authorname%

    I explain again what I want to do:

    me and you we are user in mystie.com and we are author.
    you when are loggedin if you select " my post " from menu, you will see list of your own post, and if I do the same I'll see my posts.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.