• Need help with writing conditional for my wordpress site (cant find similar thread). Dont know if it can be done with wordpress conditional tags.

    What i want to accomplish:

    If currently logged user published 0 posts show something (for example link number one) else if user published more than 0 posts show something else (link number two).

    I managed to write myself simple if statements for displaying menus depending on user role but i cannot find solution for this problem.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I think this will do what you want:

    $user_post_count = count_user_posts( get_current_user_id() );
    if ( $user_post_count > 0 ) {
       // code here for has posts
    } else {
       // code here for no posts
    }
    Thread Starter th3rion

    (@th3rion)

    Yes it worked – thank you very much ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if statement for user post count’ is closed to new replies.