DesignWall on "[Plugin: DW Question & Answer] How to change the author link format"

ساخت وبلاگ

The DW Q&A plugin produces links to author/questioner pages in this format:

http://mywebsite.com/questions/?user=useame

In my custom theme, multisite, I need them to be in this format:

http://mywebsite.com/useame

I had added this to functions.php, based on a function in Buddypress:

function modified_author_link ( $user_id = 0, $user_nicename = false, $user_login = false ) {
if ( empty( $user_id ) ) { retu;
}
$user_info = get_userdata( $user_id );
$useame = $user_info->user_login;
$domain = trailingslashit( network_home_url() . '/' . $useame );
retu $domain;
}
add_filter( ‘author_link’, ‘modified_author_link’ );

But it doesn't do anything. What am I doing wrong? Other suggestions?

https://wordpress.org/plugins/dw-question-answer/

I see the mywebsite.com/questions/?user=useame comes from User.php. To get the author_link format I want, I have to change this in function dwqa_get_author_link:

if ( $question_link ) { retu add_query_arg( array( 'user' => urlencode( $user->user_login ) ), $question_link ); } else { retu get_the_author_link( $user_id ); }

...to this:

if ( $question_link ) { retu network_home_url() . $user->user_login; } else { retu get_the_author_link( $user_id ); }

Can I do that with a filter?

Hi modifiedcontent,

Thank you so much, modifiedcontent. I will add this filter in the next version of DW Q&A.

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

برچسب : نویسنده : استخدام کار wpss بازدید : 280 تاريخ : پنجشنبه 14 مرداد 1395 ساعت: 9:28