[Resolved] Disable next/previous post

Home Forums Support [Resolved] Disable next/previous post

Home Forums Support Disable next/previous post

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #320317
    miguel

    Hi,

    I would like to delete the previous/next post link. I know how to do it with CSS, but I don’t want to hide it, I want to remove it at all for SEO purposes. I don’t want Google to crawl these links.

    I recently purchased the premium theme and I thought it would be possible to remove it, but it is not. Is there any way to do it?

    Thanks

    Miguel

    GeneratePress 1.3.46
    GP Premium 1.3
    #320444
    Leo
    Staff
    Customer Support
    #320570
    miguel

    Hi Leo,

    This is exactly what I was looking for.

    Thank you very much.

    Miguel

    #320756
    Leo
    Staff
    Customer Support

    Credit to Tom πŸ™‚ Glad I could help!

    #458704
    Nicholas

    Hi, I’m trying to do the same. Where do I place the code mentioned above?

    #458841
    Leo
    Staff
    Customer Support
    #861798
    Miha

    Hey,
    I have installed Code snippet plugin and inserted php code in it.
    Activated it, but nothing happens. Previous/next posts are still there.

    Is the code mentioned above still relevant?

    Thanks!

    #861850
    David
    Staff
    Customer Support

    Hi there,

    you can disable the single post navigation in Customizer > Layout > Blog –> Single: Post Navigation.

    Make sure you have the Blog module activated in Appearance > GeneratePress.

    #861915
    Miha

    Hey David,

    I have Post navigation disabled, but there are still image links to previous/next post.
    For example: http://hupi.si/2018/09/20/aside-for-widgets/

    This element:

    <a class=”post-previous” …

    What now?

    #862067
    David
    Staff
    Customer Support

    The Dispatch site uses a custom function for that. Go to Appearance > Elements and delete ( or save as a draft ) the Custom Post Navigation hook element.

    #864118
    Miha

    It works.

    Thanks much! πŸ™‚

    #864127
    David
    Staff
    Customer Support
    #998897
    Matt

    where to I add below code to disable previous/next link at footer?

    if ( ! function_exists( ‘generate_content_nav’ ) ) :
    /**
    * Display navigation to next/previous pages when applicable
    */
    function generate_content_nav( $nav_id ) {

    global $wp_query, $post;

    // Don’t print empty markup on single pages if there’s nowhere to navigate.
    if ( is_single() ) {
    $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, ”, true );
    $next = get_adjacent_post( false, ”, false );

    if ( ! $next && ! $previous )
    return;
    }

    // Don’t print empty markup in archives if there’s only one page.
    if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) )
    return;

    $nav_class = ( is_single() ) ? ‘post-navigation’ : ‘paging-navigation’;

    ?>
    <nav role=”navigation” id=”<?php echo esc_attr( $nav_id ); ?>” class=”<?php echo $nav_class; ?>”>
    <h6 class=”screen-reader-text”><?php _e( ‘Post navigation’, ‘generate’ ); ?></h6>

    <?php if ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?>

    <?php if ( get_next_posts_link() ) : ?>

    <?php endif; ?>

    <?php if ( get_previous_posts_link() ) : ?>

    <?php endif;

    if ( function_exists( ‘the_posts_pagination’ ) ) {
    the_posts_pagination( array(
    ‘mid_size’ => apply_filters( ‘generate_pagination_mid_size’, 1 ),
    ‘prev_text’ => apply_filters( ‘generate_previous_link_text’, __( ‘← Previous’, ‘generatepress’ ) ),
    ‘next_text’ => apply_filters( ‘generate_next_link_text’, __( ‘Next →’, ‘generatepress’ ) ),
    ) );
    }

    do_action(‘generate_paging_navigation’); ?>

    <?php endif; ?>

    </nav><!– #<?php echo esc_html( $nav_id ); ?> –>
    <?php
    }
    endif; // generate_content_nav

    #998922
    David
    Staff
    Customer Support
    #1352939
    Olivier

    Hello,

    When I insert this code “Remove next/previous post links completely” in code snippets, it tells me

    The code snippet has been disabled due to an error on line 6: Cannot redeclare function generate_content_nav.

    Thanks πŸ™‚

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Disable next/previous post’ is closed to new replies.