其他頁面:
```
<?php
/*
template name:一般頁面
*/
?>
```
顯示文章作者:
```
<?php the_post(); echo get_the_author(); rewind_posts(); ?>
```
現在作者和作者文章集:
```
<?php
the_post(); // queue first post
$author_id = get_the_author_meta('ID');
$curauth = get_user_by('ID', $author_id);
$user_nicename = $curauth->user_nicename;
$display_name = $curauth->display_name;
rewind_posts(); // rewind the loop
?>
<a href="<?php echo get_author_posts_url($author_id, $user_nicename); ?>"><?php echo $display_name; ?></a> 在 <?php the_time('Y年n月j日, G:i:s'); ?> 發布 / 分類:
<?php
$categories = get_the_category();
$separator = ", ";
$output = '';
if($categories){
foreach ($categories as $category){
$output .= '<a href="' . get_category_link($category->term_id). '">'. $category->cat_name . '</a>'. $separator;
}
echo trim($output, $separator);
}
?>
```
參考:
[https://wp-mix.com/wordpress-get-author-outside-loop/](https://wp-mix.com/wordpress-get-author-outside-loop/)
分享按鈕:
[https://sharethis.com/](https://sharethis.com/)
- WordPress平臺的網站開發
- 電商主題開發
- WooCommerce主題開發優化部分
- 首頁開發
- WooCommerce
- 判斷用戶是否登錄
- WordPress Menu
- WooCommerce PayPal Checkout Gateway
- 頁面和文章
- 調用產品和文章
- 判斷屬于哪個頁面
- 相關文章
- 消除文章分享按鈕集底部的文字
- wordpress主題模板和主題開發
- wordpress主題準備
- wordpress主題文件結構
- 豪源主題
- WooCommerce SEO
- 插件開發
- wordpress二次開發
- theme基本顯示
- menu調用
- 分拆為header.php和footer.php
- 頁面、文章樣式選擇顯示
- 面包屑導航 Breadcrumb
- 特色圖
- 閱讀次數統計
- 分頁功能
- Advanced Custom Fields
- Custom Post Type UI
- post type
- 小工具
- 小工具調用
- shortcode
- 文章循環輸出
- 標題和文章限制字數輸出顯示
- WordPress主題theme1開發
- wordpress搭建多站點
- wordpress常用函數
- wordpress循環代碼
- Woocommerce
- Woocommerce支持
- WordPress插件開發
- wordpress會員插件
- WordPress插件使用
- WordPress插件集
- WordPress的核心
- Wordpress原理
- Wordpress要點
- WordPress網站搬家
- WPML
- 服務器
- Cloud 9
- test
- 網站