WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #42254, comment 10


Ignore:
Timestamp:
11/05/2017 08:54:22 AM (3 years ago)
Author:
Iceable
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #42254, comment 10

    initial v1  
    1 The offset could be 0 for the first feed (obviously), and then the the sum of `$args['items']` of the previous feed(s) for the next one(s).
    2 With the current feeds this would pull 1 item from the first feed and 3+1 from the second.
    3 And if I am not mistaken this is exactly the margin needed to anticipate duplicates even in case the `'items'` args values change or if another feed is added in the future.
    4 I'm not even sure this will ever happen, but I like to avoid arbitrary and make things as flexible as possible :)
     1Thinking about it, the necessary offset to handle possible duplicates is actually the number of items already displayed. Since we keep them in an array already to check for duplicate, we can conveniently count them.
     2So basically:
     3
     4{{{
     5$args['items'] = $args['items'] + count( $displayed_links );
     6}}}
     7
     8This will also work in case the `'items'` args values change or if another feed is added in the future. I'm not sure this will ever happen, but I like to make things as flexible as possible :)
    59
    610You are absolutely right about the filename, my bad. Files with camelCase names seem much older, and those named with snake-case seem to be the most recent ones.