[wp-trac] [WordPress Trac] #45708: Allow retrieving adjacent image link markup without echoing it

WordPress Trac noreply at wordpress.org
Wed Dec 19 17:19:29 UTC 2018


#45708: Allow retrieving adjacent image link markup without echoing it
--------------------------+-------------------------------------
 Reporter:  flixos90      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:  needs-patch 2nd-opinion
  Focuses:  template      |
--------------------------+-------------------------------------
 Currently, themes can only echo image links (via `next_image_link()`,
 `previous_image_link()` and indirectly `adjacent_image_link()`), but not
 retrieve the markup before printing it. This is a problem, since you often
 want to manually print extra markup, however only if there are actual
 image links to display. You can currently of course accomplish that by
 using an output buffer, but that is far from preferred.

 Most other templating functions have two versions, one for retrieving the
 markup, the other for echoing it (for example `previous_post_link()` and
 `get_previous_post_link()`). We should add the necessary counterparts for
 these ones too.

 As another indicator that this has been needed for a long time, you might
 want to look at this article from 2009: https://katz.co/911/

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45708>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list