說明:返回指定文章ID的標(biāo)題,如果文章是protected 或者private,則返回Protected: 標(biāo)題或者Private:標(biāo)題,在循環(huán)內(nèi)部和外部都可以使用,如果在外部則必須指定文章ID.
用法:<?php echo get_the_title($ID); ?>
參數(shù):$ID (int) (optional) 文章ID或者在循環(huán)中是獲取當(dāng)前文章的標(biāo)題,默認(rèn)為空.
返回值:string 文章標(biāo)題,如果文章是protected 或者private,則返回Protected: 標(biāo)題或者Private:標(biāo)題.
例子:輸出當(dāng)前文章標(biāo)題
<?php echo get_the_title(); ?>
頁面面包屑導(dǎo)航,兩個層次:
- <div class='breadcrumb'>
- <?php // if there is a parent, display the link
- $parent_title = get_the_title($post->post_parent);
- if (
- $parent_title != the_title(' ', ' ', false) ) {
- echo '<a href=' .
- get_permalink($post->post_parent) . ' ' . 'title=' . $parent_title . '>' . $parent_title . '</a> »
- ';
- }
- // then go on to the current page link
- ?>
- <a href='<?php the_permalink() ?>'rel='bookmark' title='<?php the_title(); ?>'>
- <?php the_title(); ?></a> »
- </div>
新聞熱點
疑難解答
圖片精選