• 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

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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.

    the author link

    The link structure for an ‘author’ posts is
    //https://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)

    Thread Starter Reza Shadpay

    (@reza-sh)

    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?

    What did you do?

    Thread Starter Reza Shadpay

    (@reza-sh)

    I added same link you mentioned: https://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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘adding " my posts " in menu’ is closed to new replies.