最新公告
  • 欢迎您光临站盟网(原知事网),一个优质的网站源码基地、精品网站模板和插件。欢迎加入永久SVIP
  • WordPress函数the_title()用法 调用当前文章标题

    正文概述 知事网   2020-09-11 09:09   418

    描述:

    显示当前文章的标题

    用法:

    <?php the_title( $before, $after, $echo ); ?>

    参数:

    $before
    
    (string) (可选) 标题之前显示的文本
    
    默认值: None
    
    $after
    
    (string) (可选) 标题之后显示的文本
    
    默认值: None
    
    $echo
    
    (Boolean) (可选) 显示标题(TRUE)或将其返回以在PHP中使用(FALSE)。
    
    默认值: TRUE

    源文件:

    /**
    * Display or retrieve the current post title with optional content.
    *
    * @since 0.71
    *
    * @param string $before Optional. Content to prepend to the title.
    * @param string $after Optional. Content to append to the title.
    * @param bool $echo Optional, default to true.Whether to display or return.
    * @return string|void String if $echo parameter is false.
    */
    function the_title( $before = '', $after = '', $echo = true ) {
    $title = get_the_title();
    
    if ( strlen($title) == 0 )
    return;
    
    $title = $before . $title . $after;
    
    if ( $echo )
    echo $title;
    else
    return $title;
    }

    站盟网 » WordPress函数the_title()用法 调用当前文章标题

    发表评论

    还没有评论,快来抢沙发吧!

    如需帝国cms功能定制以及二次开发请联系我们

    联系作者
    请选择支付方式
    ×
    支付宝支付
    微信支付
    余额支付
    ×
    微信扫码支付 0 元