[Resolved] Remove it from source code to?

Home Forums Support Remove it from source code to?

  • This topic has 5 replies, 2 voices, and was last updated 3 years ago by Tom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #380352
    Jonatan

    Hi,

    I’m trying to remove the next/prev links at the bottom of a post

    so far I did custom CSS:
    .entry-meta {
    display: none;
    }

    that makes it disappear visually, but when I right click source code I still see the link with text and rel=”prev” and rel=”next”

    How do I remove that function completely I don’t need it

    Thank you appreciate it 🙂

    GeneratePress 1.4
    GP Premium 1.4.3
    #380485
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This is an option in the upcoming GPP 1.5.

    For now, you can do this:

    add_filter( 'next_post_link', '__return_false' );
    add_filter( 'previous_post_link', '__return_false' );
    #380579
    Jonatan

    Cool thanks!

    #380718
    Tom
    Lead Developer
    Lead Developer
    #380874
    Jonatan

    Sorry for asking again but where do I put that code?

    I use child theme and this is how my functions.php looks now:

    <?php
    /**
     * Generate child theme functions and definitions
     *
     * @package Generate
     */
     
    if ( ! function_exists( 'generate_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function generate_posted_on() {
    
    	if ( 'post' !== get_post_type() )
    		return;
    
    	printf( __( '<span class="byline">%1$s</span>', 'generate' ),
    		sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <span class="author-name" itemprop="name">%2$s</span></span>',
    			__( 'by','generate'),
    			esc_html( get_the_author() )
    		)
    	);
    }
    endif;
    
    add_filter( 'next_post_link', '__return_false' );
    add_filter( 'previous_post_link', '__return_false' );

    But it doesn’t work the rel=”prev” still shows in the source code.
    Thanks!

    #381049
    Tom
    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.