Shows Author Description On WordPress Sidebar
需要修改主題Sidebar部分相關文件。核心代碼如下。
- <?php
- if(is_string(get_the_author_description())) {
- the_author_description();
- }
- ?>
我當前使用的代碼如下。
- <?php if(is_string(get_the_author_description())) { ?>
- <li>
- <h2>Profile</h2>
- <p><?php the_author_description(); ?></p>
- </li>
- <?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部分相關文件。核心代碼如下。
- <?php
- if(get_the_author_description()!="") {
- the_author_description();
- }
- ?>
我當前使用的代碼如下。
- <?php if(get_the_author_description()!="") { ?>
- <li>
- <h2>Profile</h2>
- <p><?php the_author_description(); ?></p>
- </li>
- <?php } ?>