[英]Remove author page link from Gravatar image
我想取消鏈接圖像。 副標題中的當前頭像圖像已與作者頁面鏈接,我想在帖子副標題中創建該副圖像,而沒有任何鏈接。
我用於在帖子的署名中顯示Gravatar的代碼是:
add_action( 'genesis_entry_header', 'cd_author_gravatar' );
function cd_author_gravatar() {
if ( is_singular( 'post' ) ) {
$entry_author = get_avatar( get_the_author_meta( 'email' ), 64 );
$author_link = get_author_posts_url( get_the_author_meta( 'ID' ) );
printf( '<div class="author-avatar"><a href="%s">%s</a></div>', $author_link, $entry_author );
}
}
我不知道在上面的代碼中要刪除什么,這樣我就只能獲得沒有任何可點擊鏈接的圖像。
在應用上述代碼后,每當我將Gravatar圖像懸停在其下划線時,它就會顯示“ example.com/author/admin/”
謝謝。
您的代碼應如下所示:
add_action( 'genesis_entry_header', 'cd_author_gravatar' );
function cd_author_gravatar() {
if ( is_singular( 'post' ) ) {
$entry_author = get_avatar( get_the_author_meta( 'email' ), 64 );
printf( '<div class="author-avatar">%s</div>', $entry_author );
}
}
我想您會在這里找到不同的地方;)您只需要刪除將指向作者帖子的鏈接加載到變量$ author_link的行,然后從printf和$ author_link的用法中刪除“ a href”。
編輯:代碼已更新;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.