.multiple <body> class #41

Closed
justintadlock opened this Issue Sep 29, 2013 · 10 comments

4 participants

@justintadlock

Non-singular views should have a .multiple class for easier styling. This would show on is_home(), is_archive(), or is_search(). Yeah, I know some of you've asked for this for a while. It's coming.

@ryanve

I like .plural to oppose .singular

is_singular() ? 'singular' : 'plural'
@justintadlock

I like plural too just because I'm an English geek. :)

@ryanve

Exactly :) That should make it easy to document too.

@turtlepod

twentyfourteen use "list-view"

    if ( is_archive() || is_search() || is_home() )
        $classes[] = 'list-view';
@justintadlock

plural was the choice I made. This is in HC 2.0.

@lkraav

To briefly follow-up on this, would you consider adding is_plural() as a framework level function? I'm finding I have to define this function for every new theme because most conditions apply to all 3 mentioned views. Seems like it'd make sense to move this up to hybrid-base or hybrid-core. Comments?

@justintadlock

Great idea! I'll definitely add that to HC.

Now, I'm wondering why I never thought to put it in a function since I use that sort of code in nearly all my themes...

@justintadlock

Now that I'm thinking about this more, do we really need a hybrid_is_plural()? Does a !is_singular() check not really cover that?

It seems like I had some good reason that I now can't remember for doing this:

if ( is_home() || is_archive() || is_search() )

Are there any potential hangups with just using !is_singular()?

@turtlepod

i think it's for 404 pages.

@justintadlock

Ah, yep, that was it! I knew there was a good reason.

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