Rework _s_content_nav() to only print markup if links will be printed. #28

Closed
mfields opened this Issue Aug 7, 2012 · 2 comments

Comments

Projects
None yet
4 participants
Contributor

mfields commented Aug 7, 2012

_s prints navigation markup even if no links are generated. What do you think about adjusting the logic in _s_content_nav() so that it only prints html if a link is present? I think that this would be a great modification for two reasons:

  1. Some themes may style the nav element and would display as an empty box if there are one page or less worth of posts.
  2. Users of screen readers will not hear the "Post navigation" heading read to the screen where there are no links at all.
Contributor

ianstewart commented Aug 9, 2012

Sounds like a good idea to me. I'm pretty big on conditional markup.

Contributor

kovshenin commented Aug 15, 2012

Opened a pull request right here: #38

It's not very obvious if you haven't dealt with the get_adjacent_post function, but if you look at adjacent_post_link (which is used by previous_post_link and next_post_link) you'll see why I'm doing some special behaviour around attachment posts. The previous link will always link to the attachment post parent, even if there's more than one attachments to that post.

We currently don't use _s_content_nav in image.php, but if one would, they'll still get the expected results. Let me know what you think!

@ghost ghost assigned mfields Sep 13, 2012

@kovshenin kovshenin closed this in 6465b5a Sep 14, 2012

ianstewart added a commit that referenced this issue Sep 14, 2012

Merge pull request #38 from kovshenin/patch-6
Don't print markup in _s_content_nav() when it is not needed. Fixes #28. props @kovshenin

@obenland obenland removed the Suggest Merge label Mar 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment