php - How can I get Wordpress user ID? -


i want use twitter follow button site authors on posts.

the twitter structure here:

<a href="https://twitter.com/twitterapi" class="twitter-follow-button" data-show-count="false" data-lang="en">follow @twitterapi</a> 

yes, works place must generic. should import wordpress $user->id in structure. how can this?

you can use get_current_user_id() in wordpress.

to author of current post try following

  <a href="https://twitter.com/<?php esc_attr_e(get_the_author()) ?>"       class="twitter-follow-button"       data-show-count="false" data-lang="en">follow @<?php echo get_the_author() ?></a> 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -