Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Brandon Allen

    (@thebrandonallen)

    Any of the default WP functions should return the correct url. Ie. – get_author_posts_url()

    Thread Starter tei

    (@tei)

    Thank you for your answer.

    I’m sorry. My explanation was not enough.
    I want to make Member list page that link with a Member individual page.
    I tryed with the below code in custom Page Templates(members.php):

    <?php
    $users =get_users( array('orderby'=>ID,'order'=>ASC,) );
    	echo '<div class="users">';
    	foreach($users as $user):
    		 $uid = $user->ID;
    		 $userData = get_userdata($uid);
    			 echo '<div class="user_list_wrap">';
    			 echo '<div class="user_avatar"><a href="' .get_bloginfo(url).'/?author='.$uid. '">';
    			 echo get_avatar( $uid );
    			 echo '</a></div>';
    			 echo '<div class="user_info_list">';
    			 echo '<h2 class="nickname"><div class="user_cap">name:</div>'.$user->display_name.'</h2>';
    			 echo '</div>';
    			 echo '</div>';
    	endforeach;
    echo '</div>';
    ?>

    but output URL was below:
    http://example.com/ninja/master-ninja/?author=1 (example)

    URL was do not redirect. (but customized author URL is exist. e.g. http://example.com/member/master-ninja/ )
    This code is wrong? or Do you know other ways.

    Thanks!

    Plugin Author Brandon Allen

    (@thebrandonallen)

    In order to get
    http://example.com/member/master-ninja/
    as your output url, you need to, first, make sure you have your author base set to ‘members’ on the Edit Author Slug settings page. Then try this:

    <?php
    $users =get_users( array('orderby'=>ID,'order'=>ASC,) );
    	echo '<div class="users">';
    	foreach($users as $user):
    		 $uid = $user->ID;
    		 $userData = get_userdata($uid);
    			 echo '<div class="user_list_wrap">';
    			 echo '<div class="user_avatar"><a href="' .get_author_posts_url($uid). '">';
    			 echo get_avatar( $uid );
    			 echo '</a></div>';
    			 echo '<div class="user_info_list">';
    			 echo '<h2 class="nickname"><div class="user_cap">name:</div>'.$user->display_name.'</h2>';
    			 echo '</div>';
    			 echo '</div>';
    	endforeach;
    echo '</div>';
    ?>
    Thread Starter tei

    (@tei)

    I tried it.
    I have just resolved!
    I understood it.

    Thank you for your correspondence!!

    Plugin Author Brandon Allen

    (@thebrandonallen)

    You’re welcome. Glad you got it fixed!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I get author's customized url as php tag?’ is closed to new replies.