Why is the WordPress CSS Cheat Sheet being a weapon for Web Designers?
Why is the WordPress CSS Cheat Sheet being a weapon for Web Designers?
WordPress is a world leading Content Management system which is used to develop/design the websites/web applications. People who have low coding knowledge also easy to learn WordPress.
In current time, there are lot of page builders & Plugins to do Drag & Drop website building. Without none of the coding knowledge we can design 80% websites. To design the rest websites, sometimes we need to use coding. Because some features cannot be implemented using Plugins. Even it is possible, using too much plugin impact for the Optimization. And that is not good practice for use too many plugins for every small tasks (Below I answered why).
If you’re familiar with WordPress documentation, you can find Custom PHP functions and CSS classes which are inbuilt in WordPress. We only just need to call them!
As example here I created small code which is automatically updating Footer copyright year using WordPress PHP functions (Normally we call it as Hooks).
In this article, I like to give you WordPress inbuilt CSS classes list (in other words CSS Cheat Sheet). Someone may ask a question, why we want to code custom CSS… We can use CSS editor plugins like Pencil, CSS Hero?? Answer: When we are installing a plugin, it comes with lot of files. When plugin is running, server needs to give another effort to run those files too. We can do same task using few custom code lines. That’s why we need to use custom coding.
If coming back to the article, web designers easily can call these classes on Additional CSS panel, Stylesheet or any other templates. They no need to spend another time to add the class inside HTML. That’s why I put a title like that to this article.
Default Body Class Styles
// Added when a website is using a right-to-left language e.g. Arabic, Hebrew .rtl {} // Added when home page is being displayed .home {} // Added when blog page is being displayed .blog {} // Added when an Archive page is being displayed .archive {} // Added when a date based archive is displayed .date {} // Added on search pages .search {} // Added when pagination is enabled .paged {} // Added when an attachment page is displayed .attachment {} // Added when a 404 error page is displayed .error404 {} // Added when a single post is dispayed includes post ID .single postid-(id) {} // Added when a single attachment is displayed. Includes attachment ID .attachmentid-(id) {} // Added when a single attachment is displayed. Includes attachment mime-type .attachment-(mime-type) {} // Added when an author page is displayed .author {} // Added when an author page is displayed. Includes author name. .author-(user_nicename) {} // Added when a category page is displayed .category {} //Added when a category page is displayed. Includes category slug. .category-(slug) {} // Added when a tag page is displayed. .tag {} // Added when a tag page is displayed. Includes tag slug. .tag-(slug) {} // Added when a parent page is displayed. .page-parent {} // Added when a child page is displayed. Includes parent page ID. .page-child parent-pageid-(id) {} // Added when a page is displayed using page template. Includes page template file name. .page-template page-template-(template file name) {} // Added when search results are displayed. .search-results {} // Added when search returns no results. .search-no-results {} // Added when a logged in user is detected. .logged-in {} // Added when a paginated page is displayed. Includes page number. .paged-(page number) {} // Added when a paginated single item is displayed. Includes page number. .single-paged-(page number) {} // Added when a paged page type is displayed. Includes page number. .page-paged-(page number) {} // Added when a paged category page is displayed. Includes page number. .category-paged-(page number) {} // Added when a paged tag page is displayed. Includes page number. .tag-paged-(page number) {} //Added when a paged date based archive page is displayed. Includes page number. .date-paged-(page number) {} // Added when a paged author page is displayed. Includes page number. .author-paged-(page number) {} // Added when a paaged search page is displayed. Includes page number. .search-paged-(page number) {}
For instance, if you wanted the ‘News’ category page to have a different background color, then you can add the following custom CSS.
.category-news {
background-color
:
#f7f7f7
;
}
Default Post Style Classes
// Adds a class with ID for single items .post-(ID) {} // Generic post claass added for single blog posts. .post {} // Generic page class added when a single page is displayed. .page {} // Generic attachment class added to attachment pages. .attachment {} // Adds a post type class e.g. type-post .type(post-type){} // Adds a class for post format if theme supports posts formats. E.g. format-standard .format-(post-format){} // Added when an item has a featured image .has-post-thumbnail{} // Added when a sticky post is displayed .sticky {} // Generic class to display an entry .hentry {} // Classes with categories assigned to a post. E.g. category-news category-movies .category-(slug) {} // Classes with tags assigned to a post. e.g. tag-photofriday tag-tgif .tag-(slug) {}
Default Navigation Menu Classes
// Class for Current Page .current_page_item{} // Class for Current Category .current-cat{} // Class for any other current Menu Item .current-menu-item{} // Class for a taxonomies .menu-item-type-(taxonomy){} // class to distinguish post types. .menu-item-type-(post_type){} // Class for any custom item that you added .menu-item-type-custom{} // Class for the Home Link .menu-item-home{}
Default WordPress Widget Classes
.widget {} #searchform {} .widget_search {} .screen-reader-text {} .widget_meta {} .widget_meta ul {} .widget_meta ul li {} .widget_meta ul li a {} .widget_links {} .widget_links ul {} .widget_links ul li {} .widget_links ul li a {} .widget_archive {} .widget_archive ul {} .widget_archive ul li {} .widget_archive ul li a {} .widget_archive select {} .widget_archive option {} .widget_pages {} .widget_pages ul {} .widget_pages ul li {} .widget_pages ul li a {} .widget_links {} .widget_links li:after {} .widget_links li:before {} .widget_tag_cloud {} .widget_tag_cloud a {} .widget_tag_cloud a:after {} .widget_tag_cloud a:before {} .widget_calendar {} #calendar_wrap {} #calendar_wrap th {} #calendar_wrap td {} #wp-calendar tr td {} #wp-calendar caption {} #wp-calendar a {} #wp-calendar #today {} #wp-calendar #prev {} #wp-calendar #next {} #wp-calendar #next a {} #wp-calendar #prev a {} .widget_categories {} .widget_categories ul {} .widget_categories ul li {} .widget_categories ul ul.children {} .widget_categories a {} .widget_categories select{} .widget_categories select#cat {} .widget_categories select.postform {} .widget_categories option {} .widget_categories .level-0 {} .widget_categories .level-1 {} .widget_categories .level-2 {} .widget_categories .level-3 {} .recentcomments {} #recentcomments {} #recentcomments li {} #recentcomments li a {} .widget_recent_comments {} .widget_recent_entries {} .widget_recent_entries ul {} .widget_recent_entries ul li {} .widget_recent_entries ul li a {} .textwidget {} .widget_text {} .textwidget p {}
Codes credits: wpbeginner.com
Thank you.