WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#14440 new enhancement

Override filter for adjacent_post_link()

Reported by: mfields Owned by:
Priority: normal Milestone: Future Release
Component: Template Version: 3.0
Severity: normal Keywords: reporter-feedback
Cc:

Description

I'm working on a plugin that needs to integrate with as many themes as possible. It's basically a plugin for creating portfolios of images. It uses a custom post_type "piece" and allows for each piece to have multiple images attached to it. I've created a widget that lists thumbnails for all attached images that link to the attachment page for each one. On the attachment page, I am querying for the parent piece to display the title, content, excerpt, edit link, etc.

I'm also trying to replace the previous and next links with the values that would be generated for the parent. I've gotten pretty far along when I noticed that adjacent_post_link() is set to display only a previous link when an attachment has been queried. I was wondering if a filter could put put in place somewhere before this conditional is defined. Please see attached file.

Thanks for reading!

Attachments (1)

adjacent_post_link.patch (628 bytes) - added by mfields 3 years ago.

Download all attachments as: .zip

Change History (3)

mfields3 years ago

comment:1 mfields3 years ago

  • Keywords dev-feedback added
  • Version set to 3.0

comment:2 nacin3 years ago

  • Keywords reporter-feedback added; dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release

That's not quite the logic. If it's an attachment and it's looking backward, it uses the post parent. Otherwise, it calls get_adjacent_post(). That function in turn makes some queries.

Can you re-evaluate?

Note: See TracTickets for help on using tickets.