Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Blog pagination issue w/ woocommerce - links shift from /blog to /store pages #836

Closed
dberz opened this issue Jun 14, 2016 · 9 comments
Closed
Labels

Comments

@dberz
Copy link

dberz commented Jun 14, 2016

You can see this here:

I have not adjusted the FoundationPress index.php pagination code from the default:

            <?php /* Display navigation to next/previous pages when applicable */ ?>
            <?php if ( function_exists( 'foundationpress_pagination' ) ) { foundationpress_pagination(); } else if ( is_paged() ) { ?>
                <nav id="post-nav">
                    <div class="post-previous"><?php next_posts_link( __( '&larr; Older posts', 'foundationpress' ) ); ?></div>
                    <div class="post-next"><?php previous_posts_link( __( 'Newer posts &rarr;', 'foundationpress' ) ); ?></div>
                </nav>
            <?php } ?>

Would like to keep the blog post pagination links to blog pages, and the store page links to store pages.

Any thoughts are appreciated!

@ghost
Copy link

ghost commented Jun 21, 2016

@dberz, did you get this?
index.php is a basic archive template. You can filter its output using pre_get_posts hook:
https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

Or, you could create a custom loop template for your blog entries, using wp_query arguments:
$args = array( 'post_type' => 'post' );
https://codex.wordpress.org/Class_Reference/WP_Query

@dberz
Copy link
Author

dberz commented Jun 21, 2016

@Eccola thank you! I will investigate this.

I'm surprised that customization is needed as FoundationPress supports woocommerce products & blog posts. I would think the pagination links would work out of the box.

@colin-marshall
Copy link
Collaborator

@deberz I agree this should work out of the box. Will try to have a look in the future at this.

@dberz
Copy link
Author

dberz commented Jun 28, 2016

Thanks @colin-marshall and team. You guys do a great job on this project!

One note per @Eccola's suggestion above: I was able to set a post_type specific loop within index.php, but FoundationPress seems to lose that post_type requirement on page two of the search results. (ex. https://parsleyhealth.com/blog/page/2). Is the loop for pages past pages 2-n controlled somewhere else?

My page 1 correctly displays all pages as 'posts', only on page 2 does this jump to 'products'.

@colin-marshall
Copy link
Collaborator

@dberz I'm trying to reproduce locally. Could you please provide me with screenshots of Settings -> Reading and Settings -> Permalinks? Also, do you have a repo of your theme I could take a look at?

Thanks!

@dberz
Copy link
Author

dberz commented Jun 30, 2016

Thank you @colin-marshall. Settings > Permalinks screenshot attached below.

Happy to share my bitbucket repo with you privately.

screencapture-parsleyhealth-com-wp-admin-options-permalink-php-1467311569596

@colin-marshall
Copy link
Collaborator

@dberz thanks! Can I also please get a screenshot of the Reading settings?

@dberz
Copy link
Author

dberz commented Jun 30, 2016

Attached!

image

@dberz
Copy link
Author

dberz commented Jul 6, 2016

Update: this issue has resolved itself after I deactivated all plugins and reactivated them.

Cause is unknown, but perhaps a caching layer or my 'autoptimize' plugin was part of the problem.

@dberz dberz closed this as completed Jul 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants