Shows Author Description On WordPress Sidebar


需要修改主題Sidebar部分相關文件。核心代碼如下。

  1. <?php
  2.     if(is_string(get_the_author_description())) { 
  3.         the_author_description();
  4.     } 
  5. ?>

我當前使用的代碼如下。

  1. <?php if(is_string(get_the_author_description())) { ?>
  2.     <li>
  3.         <h2>Profile</h2>
  4.         <p><?php the_author_description(); ?></p>
  5.     </li>
  6. <?php } ?>

09-06-28更新。在WordPress 2.8版本有關説明中,提到這樣一點,「Deprecate the_author_ID, the_author_login, the_author_firstname, the_author_lastname, the_author_nickname, the_author_email, the_author_url, the_author_aim, the_author_yim, the_author_mns, the_author_description and all their "get_*()" functions. (The full list at wp-includes/deprecated.php) 」,剛好對前面的修改有影響。下面是更新後的修改方法。

需要修改主題Sidebar部分相關文件。核心代碼如下。

  1. <?php
  2.     if(get_the_author_description()!="") { 
  3.         the_author_description();
  4.     } 
  5. ?>

我當前使用的代碼如下。

  1. <?php if(get_the_author_description()!="") { ?>
  2.     <li>
  3.         <h2>Profile</h2>
  4.         <p><?php the_author_description(); ?></p>
  5.     </li>
  6. <?php } ?>

Leave a Reply