Home › Forums › Pro Support › Remove Links from date/author
Tagged: meta, Remove author/date link
This topic contains 7 replies, has 4 voices, and was last updated by Tom 4 months, 1 week ago.
-
AuthorPosts
-
January 9, 2018 at 2:14 pm #3238
Hi Tom,
first of all, a big thank you for your awesome work. Really enjoy the combination of GP + WPShowposts (both Premium).I’m looking for a solution how to remove the links from the date/autor meta box within a WP-Post-List embeded via the sections-feature. Currently using the following filter, which works with the standard blog-overview/single posts. Seems I’m missing something here:
add_filter( 'generate_post_date_output','tu_remove_date_link', 10, 2 ); function tu_remove_date_link( $output, $time_string ) { printf( '<span class="posted-on">%s</span>', $time_string ); } add_filter( 'generate_post_author_output','tu_no_author_link' ); function tu_no_author_link() { 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="fn n 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() ) ) ); }
Thanks in advance. Cheers from Bonn, Germany
SvenJanuary 28, 2018 at 8:14 pm #3452Hi there,
Sorry for not getting back to you sooner!
WPSP uses different filters. This should help:
add_filter( 'wpsp_author_output', 'tu_wpsp_remove_author_link' ); function tu_wpsp_remove_author_link() { printf( '<span class="wp-show-posts-byline wp-show-posts-meta"> <span class="wp-show-posts-author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author"> <span class="author-name" itemprop="name">%1$s</span> </span> </span>', esc_html( get_the_author() ) ); } add_filter( 'wpsp_date_output', 'tu_wpsp_remove_date_link' ); function tu_wpsp_remove_date_link() { $time_string = '<time class="wp-show-posts-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="wp-show-posts-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() ) ); printf( '<span class="wp-show-posts-posted-on wp-show-posts-meta">%1$s</span>', $time_string ); }
October 12, 2018 at 8:10 am #6169Hello,
How i can remove the link on the title and the featured image ?
Thx
October 12, 2018 at 5:31 pm #6172October 14, 2018 at 12:58 pm #6186Thanks Tom 🙂
October 14, 2018 at 7:28 pm #6188You’re welcome 🙂
August 7, 2019 at 3:18 pm #10634Tom this this work for removing the category link as well?
August 7, 2019 at 5:07 pm #10638No, but you can try this to do that:
add_filter( 'wpsp_terms_output', function( $output ) { return sprintf( '<span class="wp-show-posts-terms wp-show-posts-meta">%1$s</span>', strip_tags( get_the_term_list( get_the_ID(), $settings[ 'taxonomy' ], '', apply_filters( 'wpsp_term_separator', ', ' ) ) ) ); } );
Let me know 🙂
-
AuthorPosts
You must be logged in to reply to this topic.