Home Forums WTI Like Post PRO Author Liked Posts Template in Woo Commerce My Account page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #200
    rendition
    Participant

    I am using Woo Commerce, and I have substituted their My Account page for the standard WordPress author page. In order to get the content-likes.php template part to work right, I needed to edit the way it passes the current user object to $author. This is what I did in order to use that template part in the My Account page:

    
    // $author = get_user_by( 'slug', get_query_var( 'author_name' ) );
    $author = wp_get_current_user();
         if ( !($author instanceof WP_User) )
              return;
    • This topic was modified 10 years, 3 months ago by rendition.
    #215
    Webtechideas
    Keymaster

    I am not sure if I understood your question correctly or not but if you are trying to get the current logged in user’s id, then you can use the following code and then use that value.

    $author = wp_get_current_user();
    $user_id = (int)$author->ID;

    If this is not what you wanted, then can you please explain this in details?

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘WTI Like Post PRO’ is closed to new topics and replies.