- This topic has 4 replies, 2 voices, and was last updated 6 years, 9 months ago by Tom.
-
AuthorPosts
-
November 23, 2017 at 4:36 pm #431942Denise
Hello GP Friends,
Currently the date in the metadata is a hyperlink. I would like it to just display the date and not be a link. I also need to format the date as ‘Nov 2017’, with the short month and year. Is there a way to do this? Do I need to overwrite the generate_posted_on function? If so, what code should I use? I’m using a child theme and have the premium version.
I need to do this date formatting throughout the site:
— single pages
— archive pages
— search pages
— lists from the WP Show Posts plug-inMany thanks,
DeniseNovember 23, 2017 at 8:36 pm #432034DeniseI changed a line in the generate_posted_on. This seems to have worked for part of the site, but not for the lists in WP Show Posts.
if ( ! function_exists( ‘generate_posted_on’ ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function generate_posted_on()
{
$date = apply_filters( ‘generate_post_date’, true );
$author = apply_filters( ‘generate_post_author’, true );$time_string = ‘<time class=”entry-date published” datetime=”%1$s” itemprop=”datePublished”>%2$s</time>’;
if ( get_the_time( ‘U’ ) !== get_the_modified_time( ‘U’ ) )
$time_string .= ‘<time class=”updated” datetime=”%3$s” itemprop=”dateModified”>%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() )
);// If our date is enabled, show it
if ( $date ) :
printf( ‘<span class=”posted-on”>%1$s</span>’,
sprintf( ‘%1$s’,
esc_attr( get_the_date() ),
$time_string
)
);
endif;// If our author is enabled, show it
if ( $author ) :
printf( ‘ <span class=”byline”>%1$s</span>’,
sprintf( ‘<span class=”author vcard” itemtype=”http://schema.org/Person” itemscope=”itemscope” itemprop=”author”>%1$s <span class=”author-name” itemprop=”name”>%4$s</span></span>’,
__( ‘by’,’generatepress’),
esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
esc_attr( sprintf( __( ‘View all posts by %s’, ‘generatepress’ ), get_the_author() ) ),
esc_html( get_the_author() )
)
);
endif;}
endif;November 23, 2017 at 9:15 pm #432049TomLead DeveloperLead DeveloperIt’s not possible to update in WPSP currently.
In GP, you should do this: https://generatepress.com/forums/topic/disabling-linking-to-authors-posts/page/2/#post-370185
As for the abbreviation, this might help: http://smallbusiness.chron.com/make-wordpress-show-date-abbreviations-30957.html
November 24, 2017 at 7:51 pm #433328DeniseThank you. You may close this ticket.
November 24, 2017 at 7:51 pm #433330TomLead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.