WordPress常用函数-get_the_title()教程
说明: 返回指定文章ID的标题,如果文章是protected 或者private,则返回Protected: 标题或者Private:标题,在循环内部和外部都可以使用,如果在外部则必须指定文章ID.
用法: <?php echo get_the_title($ID); ?>
参数: $ID (int) (optional) 文章ID或者在循环中是获取当前文章的标题,默认为空.
返回值: string 文章标题,如果文章是protected 或者private,则返回Protected: 标题或者Private:标题.
例子: 输出当前文章标题
<?php echo get_the_title(); ?>
页面面包屑导航,两个层次:
<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>查看更多关于WordPress常用函数-get_the_title()教程 - WordPress的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did8788