Generated styles in common code

Source: Internet
Author: User
Keywords WordPress Tag generation
Tags abstract cat class code custom default how to image

Abstract: Also consider the WordPress theme of those classes, id how to name it? In fact, the WordPress output tag generated by default has automatically generated some class and ID, this article on some common code generated in the style listed: Wp_nav_menu () Generated menus

Still consider the WordPress theme of those classes, id how to name it? In fact, the WordPress output tag generated by default has automatically generated some class and ID, this article on some common code generated in the style listed:

Wp_nav_menu () generated menu (code slightly)

The outermost layer of the class= "Menu-nav-container"

Unordered list ul style id= "Menu-nav" class= "menu" if it is a level two menu, then the style is class= "sub-menu"

Internal list item Li style id= "menu-item-7″class=" Menu-item menu-item-type-taxonomy menu-item-object-category Menu-item-7″

Description:

1, class= "Menu-item menu-item-type-taxonomy menu-item-object-category Menu-item-7″ is actually called" Menu-item "," Menu-item-type-taxonomy "," Menu-item-object-category "," menu-item-7 "four styles, the middle is separated by a space.

2, "Menu-item" in this all menu items are the same, "menu-item-type-taxonomy menu-item-object-category" This is not the same in the menu, if it is this menu item is the category generated is this code, If the menu item is the page that is invoked, the generated code becomes "

Menu-item-type-post_type Menu-item-object-page ", if this menu item is custom, then" Menu-item-type-custom menu-item-object-custom ".

3, each item in the list item "Menu-item-7" after the number is not the same

4. There is also a "Current-menu-item" in the menu item of the current category in the Subject category page.

Generated Category list Li with class= "Cat-item Cat-item-4″, where" Cat-item "in general," cat-item-4 "after the number corresponding to the category name, the article List page theme in the topic, if the current theme, there will be more" Current-cat style

Generated Category list Li with class= "Page_item Page-item-71″, where the number corresponding to" page-item-71 "in" Page_item "corresponds to the page ID

Featured Image The_post_thumbnail () with class= "thumbnail thumbnail"

System default Comment Template wp-includes\comment-template.php has also added a corresponding style for us.

Some plug-ins also generate unique style code

breadcrumb plugin id= "breadcrumb"

Get the image plugin generated in the picture class= "Attachment-100x100 wp-post-image"

In fact, these names are regular, such as "Menu-item" translation is "menu item", "Current-menu-item" Translation is "current menu item", if your English is good words is very simple.

When making a theme, we just add style attributes to the class and ID that have been named.

For example:

In the navigation menu we can add different styles to the current category of access to differentiate, that just need to add a different style to "Current-menu-item".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.