[Resolved] Remove Links from date/author

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Remove Links from date/author

This topic contains 7 replies, has 4 voices, and was last updated by  Tom 1 week, 2 days ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #3238

    Sven
    Participant

    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
    Sven

    #3452

    Tom
    Keymaster

    Hi 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
        );
    }
    #6169

    Thierry
    Participant

    Hello,

    How i can remove the link on the title and the featured image ?

    Thx

    #6172

    Tom
    Keymaster
    #6186

    Thierry
    Participant

    Thanks Tom 🙂

    #6188

    Tom
    Keymaster

    You’re welcome 🙂

    #10634

    Damond
    Participant

    Tom this this work for removing the category link as well?

    #10638

    Tom
    Keymaster

    No, 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 🙂

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.