Support » Theme: Twenty Twenty » How to remove the hyperlink of the DATE appearing after post title

  • Resolved Forever Young

    (@sdforever)


    The date appearing with a ahref link to the post url.

    How to show the date within a span only and without any hyperlink.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, the date is linked in the event that a post doesn’t have a title so that you can still navigate to the singular version if browsing through a list of posts/search results/etc.

    There isn’t an option to disable the date from being linked that you can turn on/off so you’d have to create a child theme ( https://developer.wordpress.org/themes/advanced-topics/child-themes/ ) and then copy /inc/template-tags.php over into your child theme.

    Look for line 364-380 in that file

    // Post date.
    				if ( in_array( 'post-date', $post_meta, true ) ) {
    
    					$has_meta = true;
    					?>
    					<li class="post-date meta-wrapper">
    						<span class="meta-icon">
    							<span class="screen-reader-text"><?php _e( 'Post date', 'twentytwenty' ); ?></span>
    							<?php twentytwenty_the_theme_svg( 'calendar' ); ?>
    						</span>
    						<span class="meta-text">
    							<a href="<?php the_permalink(); ?>"><?php the_time( get_option( 'date_format' ) ); ?></a>
    						</span>
    					</li>
    					<?php
    
    				}

    And remove the tag for the post date there.

    @jarretc I am already using child theme. Also i updated the file /inc/template-tags.php from child theme but it has no effect. [Note: All other files like header.php, footer.php, or singular.php are accessible and working nicely from my child theme.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.