• Azizul Karim

    (@azizul-karim-aec)


    This is the entry meta of post. There date is printed with link. I want to unlink the date.

    function sparkling_posted_on() {
    	$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
    	}
    
    	$time_string = sprintf( $time_string,
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_date() )
    	);
    
    	printf( '<span class="posted-on"><i class="fa fa-calendar"></i> %1$s</span><span class="byline"> <i class="fa fa-user"></i> %2$s</span>',
    		sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
    			esc_url( get_permalink() ),
    			$time_string
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			esc_html( get_the_author() )
    		)
    	);
    }
Viewing 1 replies (of 1 total)
  • Free WP TP

    (@freewptp)

    Hi @tiger,

    I hope you are well today and thank you for your question.

    You can achieve this by creating a child theme of Sparkling theme and then add the following code in the functions.php file of it.

    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function sparkling_posted_on() {
    	$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
    	}
    
    	$time_string = sprintf( $time_string,
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_date() )
    	);
    
    	printf( '<span class="posted-on"><i class="fa fa-calendar"></i> %1$s</span><span class="byline"> <i class="fa fa-user"></i> %2$s</span>',
    		$time_string,
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			esc_html( get_the_author() )
    		)
    	);
    }

    Best Regards,
    Movin

Viewing 1 replies (of 1 total)
  • The topic ‘Unlink date in post meta’ is closed to new replies.