Skip to content
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

Use correct, non-home partial on archive pages' LMP posts. #925

Merged
merged 8 commits into from Nov 3, 2015

Conversation

benlk
Copy link
Collaborator

@benlk benlk commented Oct 15, 2015

Changes

  • Creates new function largo_load_more_posts_choose_partial(), which returns the slug of the partial that should be combined with partials/content- to get the correct partial to render content with get_template_part( 'partials/content', $partial );
    This function detects the following archive pages and replies with the corresponding partial slug:
    • series with series landing page : series
    • series without series landing page: series
    • category: archive
    • author: archive
    • tag: archive
    • date: archive
    • argo links posts: argolinks
    • unspecified: home
  • largo_load_more_posts() now uses largo_load_more_posts_choose_partial()

Why:

For #868, where the category archive page was using partials/content-archive.php but the LMP on that page was returning partials/content-home.php.

On the decision of slug to use: per this comment's research, here are the decisions and rationales:

  • series: series, because that's what Largo does
  • category: archive, because Largo uses archive for posts in the row. lensnola is based on largo, not largo-dev
  • author, tag, date: archive, because Largo uses archive in archive.php for all these types.
  • argolinks: argolinks was behavior before this PR
  • unspecified: home was behavior before this PR

Questions:

  • Should the default be '' and home be a case that is explicitly detected?
  • Should the output of this function be filterable?

@benlk
Copy link
Collaborator Author

benlk commented Oct 16, 2015

(Time for this is tracked on WE-15)

@aschweigert aschweigert modified the milestone: 0.5.3 - Widgets Oct 30, 2015
@rnagle
Copy link

rnagle commented Nov 2, 2015

Added a couple things to this:

  • The largo_load_more_posts_choose_partial function now takes one argument: $post_query -- the query we're using to build markup for LMP. Doing this rather than decode the $_POST['query'] variable a second time.
  • The return value for largo_load_more_posts_choose_partial is now fitlerable using the largo_lmp_template_partial filter. The $partial and $post_query are passed to this filter.

@benlk regarding your questions --

  1. I think it's fine to use $partial = 'home' to start. At this time, this will fallback to content.php since Largo does not include a content-home.php.
  2. See above.

@benlk
Copy link
Collaborator Author

benlk commented Nov 2, 2015

@rnagle rnagle assigned benlk and unassigned rnagle Nov 2, 2015
… the AJAX request's is_home parameter. Then move those lines down for more-readable code.
@benlk benlk assigned rnagle and unassigned benlk Nov 3, 2015
rnagle added a commit that referenced this pull request Nov 3, 2015
Use correct, non-home partial on archive pages' LMP posts.
@rnagle rnagle merged commit c9d9de0 into develop Nov 3, 2015
@benlk benlk deleted the 868-correct-partial-on-archives branch February 3, 2016 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants