Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got class? #30

Open
cdharrison opened this issue Jan 10, 2012 · 8 comments
Open

Got class? #30

cdharrison opened this issue Jan 10, 2012 · 8 comments

Comments

@cdharrison
Copy link
Collaborator

Targeting some of the elements on the page is proving difficult without a class or id to target. Would you all be opposed to adding a class to the <p> surrounding post meta on posts? e.g. <p class="meta">

@cdharrison
Copy link
Collaborator Author

I was almost hesitant to add this, knowing our goal is to eliminate as much cruft as possible, but I think having a very small number of classes/IDs to target might not be a bad thing.

@splorp
Copy link
Owner

splorp commented Jan 22, 2012

I’d like to consider that we provide a completely “classless” flavour as the default version of Tersus. We could then provide “some” classes and additional IDs in the advanced layouts only.

@splorp
Copy link
Owner

splorp commented Dec 15, 2013

Since starting to use the Theme-Check plugin, I’ve noticed that WordPress “requires” the following classes:

.aligncenter
.alignleft
.alignright
.bypostauthor
.gallery-caption
.sticky
.wp-caption
.wp-caption-text

Some of these make complete sense, like the image alignment classes. I would consider adding these to the stylesheet, whether or not the decrufted code includes them right now. At least they’d be there for the child themes to hook onto.

@splorp
Copy link
Owner

splorp commented Dec 16, 2013

I’ve added the aforementioned “required” classes to a core.css stylesheet per commit 0ffc96a. Only the alignment classes have anything declared for now.

@splorp
Copy link
Owner

splorp commented Jan 1, 2014

Also according to the WordPress Theme Check Guidelines, inclusion of the body_class() call inside the <body> tag is required. In previous releases of Tersus, we opted to remove the call completely because of the massive cruftiness that it spews out.

To illustrate this, the following list of CSS classes was obtained from post-template.php in the WordPress core and shows all possible classes that body_class() can insert by default (not all at once, of course).

admin-bar
archive
attachment
attachment-<mime_type>
attachmentid-<post_id>
author
author-<author_id>
author-<user_nicename>
author-paged-<page>
blog
category
category-<slug>
category-<term_id>
category-paged-<page>
custom-background
date
date-paged-<page>
error404
home
logged-in
no-customize-support
page
page-child
page-id-<page_id>
page-paged-<page>
page-parent
page-template
page-template-<slug>
page-template-default
paged
paged-<page>
parent-pageid-<post_parent>
post-type-archive
post-type-archive-<post_type>
post-type-paged-<page>
postid-<post_id>
rtl
search
search-no-results
search-paged-<page>
search-results
single
single-<post_type>
single-format-<post_format>
single-format-standard
single-paged-<page>
tag
tag-<slug>
tag-<term_id>
tag-paged-<page>
tax-<taxonomy>
term-<slug>
term-<term_id>

Now, that’s a lot of cruft.

I recommend that we reintroduce the body_class() call, but filter its output so that only one or two classes are inserted per page. The classes I suggest that we include are as follows:

home
page
single
attachment
archive
search
error404

Optionally, we could expand the list to include these somewhat benign (but related) classes.

blog — indicates when the home page is a list of recent posts vs a single page
date — type of archive
category — type of archive
tag — type of archive
admin-bar
logged-in
rtl — right to left text

Your feedback is appreciated.

@cdharrison
Copy link
Collaborator Author

cdharrison commented Jan 1, 2014

I agree. I think limited, specific classes would be ideal.

@splorp
Copy link
Owner

splorp commented Jan 1, 2014

Cool. Check it … 4110372

@splorp
Copy link
Owner

splorp commented Jan 18, 2014

I’ve updated the labels for this issue to reflect that it requires documentation. Case in point, I’d like to add a section to the read me which lists which core classes we have included in the theme.

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

No branches or pull requests

2 participants