Homepage › Community Forums › General › Page 2 of pagination repeats all front page widget areas
Tagged: pagination
Hi Wes
Hey, I think this applies to all themes so I’m posting in general.
On the Elevate theme, the pagination at the bottom goes to /page/2/ but repeats the featured image and all the widget areas from the front page.
Is there a way to have the second page eliminate all the front page widget areas (but keep the sidebar from the bottom loop section?
One page 2 and above, I think it should just be the loop with the next set of articles starting at the top.
I’ve added this function to the front-page.php to limit the bottom category to just a single one.
/** Replace the standard loop with our custom loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_do_custom_loop' );
function child_do_custom_loop() {
global $paged; // current paginated page
global $query_args; // grab the current wp_query() args
$args = array(
'cat' => 35, // only this category
'paged' => $paged, // respect pagination
);
genesis_custom_loop( wp_parse_args($query_args, $args) );
}
thoughts? help?
Ah ha!
This is what I’m looking for: Ambition theme next buttons on blog, but for Elevate.
Would it just be some code for the front-page.php file?
or… ?
But ya, exactly what was fixed for Ambition front page blog and all the next pages after it.
Resolved partially.
Grabbed your code from Ambition and put it inside the front page function.
//* Add markup for front page widgets
function ambition_front_page_widgets() {
if ( get_query_var( 'paged' ) >= 2 )
return;
.
.
.
// etc etc<!--formatted-->
However, page 2 and beyond have no heading and the top navigation bar doesn’t show until you start to scroll. I’ll send you the url in a private msg
it’s likely lines 183 to 211 from Ambition front-page.php. Tried to hack it but wont work.
I believe I understand what’s happening there, but not sure if this bit from Ambition is specific to Ambition and cant be ported over to Elevate.
The header shows up but it has a transparent background, so that’s why you can’t see it until you sroll (then it turns black). The reason the header is transparent is because it’s designed to do that on the Homepage in order to display the background. The issue is that the 2nd page keeps the home and front-page CSS classes in the body/code, so it still treats the Header as if it’s being viewed as the homepage rather than a regular page.
Here’s a workaround –
This should add the black background for the 2nd page but will keep the homepage as it is –
.paged.featured-section .site-header {
background-color: #000;
}
Next add this to enable the space (margin-top) back for the .site-inner so it will appear as your regular pages –
.paged.front-page .site-container .site-inner {
margin-top: 100px;
overflow: hidden;
}
That fixed it when I tested it on your site. Let me know if that works.
That worked Wes. Thanks for your help. I appreciate it.
You’re Welcome!
