Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#23152 closed defect (bug) (fixed)

Twenty Twelve: Excessive CSS classes in functions.php

Reported by: tomasm's profile TomasM Owned by: lancewillett's profile lancewillett
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.5
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description (last modified by DrewAPicture)

There is navigation part in twentytwelve_content_nav function:

<nav id="<?php echo $html_id; ?>" class="navigation" role="navigation">
	<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
	<div class="nav-previous alignleft"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve' ) ); ?></div>
	<div class="nav-next alignright"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></div>
</nav><!-- #<?php echo $html_id; ?> .navigation -->

We do not need CSS classes .alignleft and .alignright here, because the .nav-previous and .nav-next already have float properties in style.css. In one case this made the links appear in different lines while constructing the child theme. Although it didn't affect vanilla Twenty Twelve. The code could be just:

<nav id="<?php echo $html_id; ?>" class="navigation" role="navigation">
	<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
	<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve' ) ); ?></div>
	<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></div>
</nav><!-- #<?php echo $html_id; ?> .navigation -->

Attachments (2)

css-example.png (6.9 KB) - added by TomasM 12 years ago.
23152.diff (1.1 KB) - added by DrewAPicture 12 years ago.

Download all attachments as: .zip

Change History (10)

@TomasM
12 years ago

#1 @DrewAPicture
12 years ago

  • Cc xoodrew@… added
  • Keywords needs-patch added

Seems sensible. As nav-previous and nav-next are already applied to this div element, adding alignleft and alignright are redundant.

Plus, the RTL stylesheet already switches the floats on nav-previous and nav-next.

@TomasM: Would you like to make a patch?

#2 @lancewillett
12 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 3.6

#3 follow-up: @TomasM
12 years ago

Funny, but I don't know how to make a patch. I'm not using any version control software - using Trac only via browser interface. Can I submit patch via browser?

#4 in reply to: ↑ 3 @DrewAPicture
12 years ago

Replying to TomasM:

Funny, but I don't know how to make a patch. I'm not using any version control software - using Trac only via browser interface. Can I submit patch via browser?

Take a peek at Submitting a Patch in the core handbook and see if that's something you're up for. If not, don't sweat it, one of us can take care of it.

#5 @DrewAPicture
12 years ago

  • Description modified (diff)

#6 @TomasM
12 years ago

Thanks Drew!

I read article, but I will have to spend more time to learn and test, so for now I will rely on you guys ;)

@DrewAPicture
12 years ago

#7 @DrewAPicture
12 years ago

  • Keywords has-patch added; needs-patch removed

#8 @lancewillett
12 years ago

  • Owner set to lancewillett
  • Resolution set to fixed
  • Status changed from new to closed

In 23427:

Twenty Twelve: remove unnecessary class values in posts navigation, fixes #23152. Props DrewAPicture.

Note: See TracTickets for help on using tickets.