8000 Correcting bug in largo_load_more_posts_choose_partial by benlk · Pull Request #1021 · WPBuddy/largo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Correcting bug in largo_load_more_posts_choose_partial #1021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 16, 2015

Conversation

benlk
Copy link
Collaborator
@benlk benlk commented Dec 14, 2015

Changes

Functionality:

  • largo_load_more_posts_choose_partial():
    • Adds tests for largo_load_more_posts_choose_partial()
    • largo_load_more_posts_choose_partial() doesn't require $_POST['is_series_landing'] to be set in order to run.
    • largo_load_more_posts_choose_partial() now checks inside the query_vars property of the WP_Query object, not various properties of the WP_Query. This should fix the problem where it was returning 'home' for categories and author archives.
    • largo_load_more_posts_choose_partial() now returns 'search' on search pages, meaning that the partials/content-search partial will be loaded on search. Since Largo does not ship that partial, this will fall back to partials/content.php.
    • largo_load_more_posts_choose_partial() and search.php now use largo_get_partial_by_post_type() to determine the correct partial for a post type. (Search view should use LMP-style partial chooser, not use featured style for homepage featured posts. #1023)
  • partials/content.php was the fallback partial on the search page, because Largo didn't ship a partials/content-search.php. Largo now ships that partial.
  • Adds new function largo_get_partial_by_post_type() that returns argolinks if the post type is argolinks, and runs a new filter largo_partial_by_post_type on the partial. This allows LMP to use plugin-defined and theme-defined partials as appropriate. (Search view should use LMP-style partial chooser, not use featured style for homepage featured posts. #1023)
  • search.php

Tests:

  • Adds tests for largo_load_more_posts_choose_partial()
  • stubbed test for largo_load_more_posts() and largo_get_partial_by_post_type()
  • Because of time constraints, this does not test for the argolinks post type.

Questions:

Why

For #1018 and we-47.

For #1023 and AJ-3

@benlk benlk added this to the hotfix milestone Dec 14, 2015
@benlk
Copy link
Collaborator Author
benlk commented Dec 14, 2015

And apparently this extends/conflicts with #1001. The good news is that this PR has been tested in Wordpress 4.4, where #1001 was causing problems.

This will not break Chicago Catalyst, which has both the 'content-archive' and 'content-search' partials.
Chicago Catalyst is currently broken.

Chicago Catalyst currently loads the 'content-search' partial in search.php and loads the 'content-archive'
partial in LMP. Chicago Catalyst and The Lens NOLA are the only sites defining content-search, and The Lens
is not on Largo 0.current, and thus is not affected by this pull request.

We should load the search partial in LMP on search pages, or not at all.
@benlk
Copy link
Collaborator Author
benlk commented Dec 15, 2015

This has been updated with a fix for #1023 for AJ-3. This seemed like the best place to apply that fix, because the solution to that fix needed to fix both LMP and the search page.

I discovered that the search page uses partials/content-search for the initial page list on page load, but later posts loaded via LMP will use partials/content-archive. Do we want to make LMP use the search partial on the search page? The only site in our umbrella tracking largo-dev is Catalyst Chicago, which has both partials/content-archive and partials/content-search, and therefore displays two different templates on page load. (The full list of partials in child themes as of this October is here.)

The split in the current code was introduced in #925: https://github.com/INN/Largo/pull/925/files#diff-398a118e99c24ab047a94c1a898033e9R163

Looking at that PR, it doesn't appear that we were using partials/content-search at all then.

  • Should this PR set the LMP partial on search pages to partials/content-search?
  • Still needs to make partials/content.php aware of is_search.

@aschweigert
Copy link

Search results, both on initial load and further posts loaded using LMP, should use the content-search partial. This got changed at some point but is one of the bugs noted in that AJ ticket. In short: the search pages look like crap and we should use the content-search partial to make them appear more like traditional search results, make the individual entries more compact, etc.

@benlk
Copy link
Collaborator Author
benlk commented Dec 15, 2015

Okay, it'll use partials/content-search now, but because we don't ship that in Largo, it will fall back to partials/content. The big display for the Homepage Featured posts won't happen anymore when that partial is displayed in search results, though, so I think we're good.

@benlk benlk modified the milestones: 0.5.4, hotfix Dec 16, 2015
@benlk benlk added the priority: high Either blocks work on a priority-normal task or a solution here informs other work. label Dec 16, 2015
benlk added a commit that referenced this pull request Dec 16, 2015
Correcting bug in largo_load_more_posts_choose_partial, adding filters, etc.
@benlk benlk merged commit 26c62fc into develop Dec 16, 2015
6D70
@aschweigert aschweigert deleted the 1018-LMP-choose-partial-hotfix branch January 5, 2016 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high Either blocks work on a priority-normal task or a solution here informs other work. type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0