TrishaM on "Force Display Name"

ساخت وبلاگ

That depends on the Theme and how it's currently displaying the user name.

Some themes bury the post 'meta' in a function, for example in the Theme TwentyEleven (old, I know but a good example nonetheless) you'll find the function 'twentyeleven_posted_on()' which constructs the date, author display name, an edit link, etc.

SO in your Theme's template file where the author display name is now showing, look to see how they are constructing that. You can replace it entirely with your own PHP to put exactly what you want there using "get_the_author_meta()" - more on that here:

https://developer.wordpress.org/reference/functions/get_the_author_meta/

Basically you'd get all the info about the author, then just echo the part you want - the user login is I believe just called 'login' (versus 'nicename' which is the displayname).

Something like:
$userName = get_the_author_meta('login'); echo $userName;

hope this helps!

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 243 تاريخ : شنبه 22 خرداد 1395 ساعت: 5:42