• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Reverse/swap post navigation in single post

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › General Genesis Framework Discussions › Reverse/swap post navigation in single post

This topic is: not resolved

Tagged: genesis_adjacent_entry_nav, post navigation

  • This topic has 6 replies, 2 voices, and was last updated 4 years, 4 months ago by tkwingwing.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • May 10, 2022 at 11:19 pm #505219
    tkwingwing
    Participant

    I'd like to swap the next/previous navigation buttons on a single post page so when clicking the 'next post' button on the right it navigates to an older post.

    I mean to swap the chronological order, I think it would be to just swap their positions. So it's currently: On the left side "<- [Post Title] (which is an older post)" and on the right side "[Post Title] (which is a newer post) ->".

    I'd like it to be on the left side "<- [Post Title] (which is a newer post)" and on the ride side "[Post Title] (which is an older post) ->".

    How can I make it? thanks

    https://www.kennethtse.net/interior-design-for-a-residential-apartment-in-grand-central-2022/
    May 10, 2022 at 11:26 pm #505220
    Brad Dalton
    Participant

    You can modify the genesis_adjacent_entry_nav function from Genesis. Copy it to your child theme and change the functions for each link.


    Tutorials for StudioPress Themes.

    May 11, 2022 at 12:08 am #505221
    tkwingwing
    Participant

    hi, Thanks for the reply,

    I am new to Genesis and have no idea about coding, would you mind giving me more hints or samples to follow? Much appreciate. thanks

    May 11, 2022 at 1:03 am #505222
    Brad Dalton
    Participant

    Happy to point you in the right direction.

    Please search for the function in your genesis folder and copy the entire function to your child theme.

    You'll need a basic understanding of PHP code to remove the default function, add a new custom function and complete the modification.


    Tutorials for StudioPress Themes.

    May 11, 2022 at 2:05 am #505223
    tkwingwing
    Participant

    I only found the genesis_adjacent_entry_nav function in post.php.

    However, when I copied the following code to the child theme's functions.php, it has no effect on my website.

    --------------------------------
    remove_action( 'genesis_after_entry', 'genesis_adjacent_entry_nav' );

    add_action( 'genesis_after_entry', 'genesis_adjacent_entry_nav2' );

    function genesis_adjacent_entry_nav2() {

    if ( ! is_singular() || ! post_type_supports( get_post_type(), 'genesis-adjacent-entry-nav2' ) ) {
    return;
    }

    genesis_markup(
    [
    'open' => '<div %s>',
    'context' => 'adjacent-entry-pagination',
    ]
    );

    $next_post_text = '<span class="adjacent-post-link">%title </span>';
    if ( genesis_a11y() ) {
    $next_post_text = '<span class="screen-reader-text">' . esc_html__( 'Next Post:', 'genesis' ) . ' </span>' . $next_post_text;
    }
    genesis_markup(
    [
    'open' => '<div %s>',
    'context' => 'pagination-next',
    'content' => get_next_post_link( '%link', $next_post_text ),
    'close' => '</div>',
    ]
    );

    $previous_post_text = '<span class="adjacent-post-link"> %title</span>';
    if ( genesis_a11y() ) {
    $previous_post_text = '<span class="screen-reader-text">' . esc_html__( 'Previous Post:', 'genesis' ) . ' </span>' . $previous_post_text;
    }
    genesis_markup(
    [
    'open' => '<div %s>',
    'context' => 'pagination-previous',
    'content' => get_previous_post_link( '%link', $previous_post_text ),
    'close' => '</div>',
    ]
    );

    genesis_markup(
    [
    'close' => '</div>',
    'context' => 'adjacent-entry-pagination',
    ]
    );

    }

    /**
    * Helper function to display adjacent entry navigation on single posts. Must be hooked to genesis_after_entry at priority 10 or earlier to work properly.
    *
    * @since 1.5.1
    */
    function genesis_prev_next_post_nav2() {

    add_post_type_support( 'post', 'genesis-adjacent-entry-nav2' );

    }

    May 11, 2022 at 2:10 am #505224
    Brad Dalton
    Participant

    That's a step in the right direction. Now you need to spend some time and work out why.

    Good start.


    Tutorials for StudioPress Themes.

    May 11, 2022 at 2:20 am #505227
    tkwingwing
    Participant

    I think the "remove_action( 'genesis_after_entry', 'genesis_adjacent_entry_nav' );"

    is not really removing the default action, but what is the right way to remove it?

    It is hard to find the solution...

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble