WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#31027 closed enhancement (worksforme)

Twenty Fifteen: improve site title code

Reported by: TomasM Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Bundled Theme Keywords: has-patch close
Focuses: Cc:

Description

Looking from the accessibility standpoint it would make sense to remove the link from H1. Ref.: http://blog.rrwd.nl/2014/11/21/html5-headings-in-wordpress-lets-fight/#comment-6970

"On the homepage the logo or site title can be put into an H1. This is not a link, because that will be a link to the page itself."

<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>

Another thing, IF statement doesn't need to check:

is_front_page() && is_home()

because is_front_page is sufficient. Ref. Codex:

"On the site front page, is_front_page() will always return TRUE, regardless of whether the site front page displays the blog posts index or a static page."

In fact, with current code, if you would set front page to static page, theme would not produce H1, but would render P instead.

Attachments (1)

31027.patch (734 bytes) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 follow-up: @SergeyBiryukov
7 years ago

Another thing, IF statement doesn't need to check:

is_front_page() && is_home()

because is_front_page is sufficient.

Looking at the similar code in Twenty Ten, perhaps is_front_page() || is_home() was the intention here.

#2 in reply to: ↑ 1 @SergeyBiryukov
7 years ago

Replying to SergeyBiryukov:

Looking at the similar code in Twenty Ten, perhaps is_front_page() || is_home() was the intention here.

Scratch that, the current code works as intended, per comment:18:ticket:30065. See [30072].

31027.patch removes the link if we want to do that.

#3 @lancewillett
7 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.2

#4 @lancewillett
7 years ago

  • Keywords close added

I don't think it's an accessibility problem to link to self on the home page. Previous default themes do this also.

I suggest closing as "worksforme".

#5 in reply to: ↑ description @iamtakashi
7 years ago

As Sergey pointed out, this is how it's intended to work.

Replying to TomasM:

In fact, with current code, if you would set front page to static page, theme would not produce H1, but would render P instead.

In this case, the page title is meant to be the h1 on the site.

I personally don't see the necessity of removing the anchor.

I also suggest closing as "worksforme".

#6 @lancewillett
7 years ago

  • Milestone 4.2 deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.