If you want to remove the link from the date field in the meta-information of the WordPress Twenty Sixteen theme, follow the following steps:
1. Create a child theme
A child theme is a theme which inherits its style and behaviour from its parent theme, but allows you to modify functions and styles. These changes are kept upon a theme update. If you don’t create a child theme, you’ll lose your changes when the theme is updated.
To create a child theme you can refer to How to create a child theme in Twenty Sixteen.
2. Add the twentysixteen_entry_date() function to functions.php of your child theme
Now you only have to add the following function to your functions.php file of your child theme. The function is quite similar to its parent version, but the link from the date field has been removed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/** * From inc/template-tags.php * Prints HTML with date information for current post. * @since Twenty Sixteen Child 1.0 */ function twentysixteen_entry_date() { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), get_the_date(), esc_attr( get_the_modified_date( 'c' ) ), get_the_modified_date() ); printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x( 'Posted on', 'Used before publish date.', 'twentysixteen' ), $time_string ); } |
That’s all!