简体   繁体   English

WordPress:如何将链接与发布日期分离?

[英]WordPress: how do you detach the link from post date?

How do I detach the link from the code below in my (child) functions.php?如何在我的(子)函数中从下面的代码中分离链接。php? I want my dates to display as regular text.我希望我的日期显示为常规文本。

<?php
if ( ! function_exists( 'twentyeleven_posted_on' ) ) :
/**
 * Prints HTML with meta information for the current post-date/time and author.
 * Create your own twentyeleven_posted_on to override in a child theme
 *
 * @since Twenty Eleven 1.0
 */
function twentyeleven_posted_on() {
    printf( __( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
        esc_url( get_permalink() ),
        esc_attr( get_the_time() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() ),
        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
        sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
        esc_html( get_the_author() )
    );
}
endif;
?>

Thanks谢谢

are you just trying to get the date of a post?你只是想得到一个帖子的日期吗? Use the function: the_date('ym-d');使用 function: the_date('ym-d');

The string parameter denotes how you want the date to be displayed.字符串参数表示您希望如何显示日期。 You can learn more about this function at the Wordpress Codex您可以在Wordpress Codex了解有关此 function 的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM