如何将出版出版社作者的默认URL从"author"更改为"members"?



在一个WordPress网站上,我使用BuddyBoss主题,并添加了一个词汇表插件。

我试图在每个词汇表术语下添加一个作者框,让网站访问者访问作者的个人资料。为此,我安装了一个名为PublishPress的插件,它几乎完成了这项工作,但默认情况下,配置文件URL会指向此人的作者配置文件https://example.com/author/hisname/,应该是https://example.com/members/hisname/

通过谷歌搜索,我发现了另一个主题的类似解决方案:

// FUNCTION
// Change Post's Author URL to Buddypress Profile URL
add_filter('generate_post_author_output','generate_post_author_output_buddyprss_url');
function generate_post_author_output_buddyprss_url( $post_author_profile_link ){
$post_author_profile_link = sprintf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
__( 'by','generatepress'),
esc_url( bp_core_get_user_domain( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'Know more about %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
) ;
return  $post_author_profile_link;
}

我想知道如何自定义脚本才能完成确切的工作。老实说,我完全搞砸了。谢谢你的帮助!

我通过专业版的PublishPress Authors解决了这个问题。在专业版中,可以编辑布局,并且有一个属性返回BuddyPress配置文件链接。

<a href="{{ author.buddypress_profile_link }}"...

而不是:

<a href="{{ author.link }}"...

最新更新