Home Page pagination
-
Hello,
I’m using a child theme of Omega and I would like to change my home page navigation at the bottom to say “Previous Posts” and be right aligned rather than showing page numbers (1, 2, next…) and left aligned.
My website is goldlionstyle.com. Any help would be greatly appreciated!
-
Hi,
you can use Code Snippets plugin and insert below snippetfunction omega_child_theme_setup() { remove_action( 'omega_after_loop', 'omega_content_nav'); add_action( 'omega_after_loop', 'omega_child_content_nav'); } endif; // omega_child_theme_setup add_action( 'after_setup_theme', 'omega_child_theme_setup', 11 ); function omega_child_content_nav() { 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; } if ( is_singular() && !get_theme_mod( 'single_nav', 0 ) ) { 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="nav-below" class="navigation <?php echo $nav_class; ?>"> <?php if ( is_single() && get_theme_mod( 'single_nav', 0 ) ) : // navigation links for single posts ?> <?php previous_post_link( '<div class="nav-previous alignleft">%link</div>', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'omega' ) . '</span> %title' ); ?> <?php next_post_link( '<div class="nav-next alignright">%link</div>', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'omega' ) . '</span>' ); ?> <?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?> <?php // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { return; } ?> <?php if ( get_next_posts_link() ) : ?> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Previous Posts', 'omega' ) ); ?></div> <?php endif; ?> <?php if ( get_previous_posts_link() ) : ?> <div class="nav-next"><?php previous_posts_link( __( 'Next posts <span class="meta-nav">→</span>', 'omega' ) ); ?></div> <?php endif; ?> <?php endif; ?> </nav><!-- #nav-below --> <?php }Then you can adjust the css to right aligned the “Previous Posts”
.nav-previous { float:right; }Hi,
Thanks and sorry for the delay in responding. I tried what you suggested and downloaded code snippet plugin, inserted the above snippet (on my development site) and nothing seemed to change…
Is this because I’m trying it on a development site on my local server? or something else?
Thanks for the help
Did you activate your snippet? It works in our test.
Hi,
I checked and it is activated but still showing the bubble letters “1 2 3 next” on the home page.
I also noticed that adding the .nav-previous code to my css didn’t affect the home page pagination; however, on my single post pages, it caused the links for both the previous post and next post to be squashed together on the right side of the screen, but I want this to stay as it was with next (newer) post links left aligned and previous (older) post links right aligned.
[All of this is being done on my development site, not the live site]
The topic ‘Home Page pagination’ is closed to new replies.
