Hello, dear readers. On this day we will learn to create beautiful breadcrumbs for regular sites, as well as for WordPress blogs. I advise you not to miss this moment, because the crumbs show the path to your article or information on the site, which will greatly facilitate navigation around the site, and they are also additional internal links.

CSS

ul( margin: 0; padding: 0; list-style: none; )

That's it, we've taken the first important step. Now let's add it all beautiful view to our little ones.

First example

The type of element itself will consist of three parts, which are connected into one whole part. To make it clearer, see the figure below:

#breadcrumbs-one( background: #eee; border-width: 1px; border-style: solid; border-color: #f5f5f5 #e5e5e5 #ccc; border-radius: 5px; box-shadow: 0 0 2px rgba(0, 0,0,.2); overflow: hidden; width: 100%; ) #breadcrumbs-one li( float: left; ) #breadcrumbs-one a( padding: .7em 1em .7em 2em; float: left; text- decoration: none; position: relative; text-shadow: 0 1px 0 rgba(255,255,255,.5); background-color: linear-gradient(to right, #f5f5f5, # ddd); ) #breadcrumbs-one li:first-child a( padding-left: 1em; border-radius: 5px 0 0 5px; ) #breadcrumbs-one a:hover( background: #fff; ) #breadcrumbs-one a ::after, #breadcrumbs-one a::before( content: ""; position: absolute; top: 50%; margin-top: -1.5em; border-top: 1.5em solid transparent; border-bottom: 1.5em solid transparent; border-left: 1em solid; right: -1em; ) #breadcrumbs-one a::after( z-index: 2; border-left-color: #ddd; ) #breadcrumbs-one a::before( border-left-color: #ccc;

right: -1.1em;

z-index: 1; ) #breadcrumbs-one a:hover::after( border-left-color: #fff; ) #breadcrumbs-one .current, #breadcrumbs-one .current:hover( font-weight: bold; background: none; ) # breadcrumbs-one .current::after, #breadcrumbs-one .current::before( content: normal; ).

#breadcrumbs-two( overflow: hidden; width: 100%; ) #breadcrumbs-two li( float: left; margin: 0 .5em 0 1em; ) #breadcrumbs-two a( background: #ddd; padding: .7em 1em ; float: left; text-decoration: #444; text-shadow: 0 1px 0 rgba(255,255,255,.5); #breadcrumbs-two a:hover( background: #99db76; ) #breadcrumbs-two a::before( content: ""; position: absolute; top: 50%; margin-top: -1.5em; border-width: 1.5em 0 1.5em 1em; border-style: solid; border- color: #ddd #ddd #ddd transparent; left: -1em; ) #breadcrumbs-two a:hover::before( border-color: #99db76 #99db76 #99db76 transparent; ) #breadcrumbs-two a::after( content : ""; position: absolute; margin-top: -1.5em; border-bottom: 1.5em solid transparent; -1em; ) #breadcrumbs-two a:hover::after( border-left-color: #99db76; ) #breadcrumbs-two .current, #breadcrumbs-two .current:hover( font-weight: bold;

background: none;

) #breadcrumbs-two .current::after, #breadcrumbs-two .current::before( content: normal; )

Third example

In the third item, the elements consist of two parts.

#breadcrumbs-four( overflow: hidden; width: 100%; ) #breadcrumbs-four li( float: left; margin: 0 .5em 0 1em; ) #breadcrumbs-four a( background: #ddd; padding: .7em 1em ; float: left; text-decoration: #444; text-shadow: 0 1px 0 rgba(255,255,255,.5); #breadcrumbs-four a:hover( background: #efc9ab; ) #breadcrumbs-four a::before, #breadcrumbs-four a::after( content:""; position:absolute; top: 0; bottom: 0; width: 1em; background: #ddd; transform: skew(-10deg ); ) #breadcrumbs-four a::before( left: -.5em; border-radius: 5px 0 0 5px; ) #breadcrumbs-four a:hover::before( background: #efc9ab; ) #breadcrumbs-four a ::after( right: -.5em; border-radius: 0 5px 5px 0; ) #breadcrumbs-four a:hover::after( background: #efc9ab; ) #breadcrumbs-four .current, #breadcrumbs-four .current :hover( font-weight: bold; background: none; ) #breadcrumbs-four .current::after, #breadcrumbs-four .current::before( content: normal; )

Example

That's all, I think these little ones are very stylish and at the same time simple. Moreover, there are no images, which means they load faster.

In all examples, the styles use the tag hover, which changes the color of the element when , also if you don’t like one of the presented colors, you can easily replace it with your own.

Now it’s time to move on to the second part, namely, we will attach one of the examples to our WordPress blog, go.

Part 2. How to Attach Breadcrumb Data to a WordPress Blog

So, first we need to download the plugin Breadcrumb NavXT, You can download it. After the plugin has been downloaded and activated, you will need to make some settings:

The settings are in the parameters. In the tab General need to find the line Breadcrumb Separator and delete the standard value that is there, in other words, you need to leave the field empty.

That's it, we're done with the plugin, now you need to choose the design that you like best. In this case, the example will be this style:

This second example, which is located earlier in the article.

Let's just copy these styles and then add them to style.css Of your theme, in any place that you like most, I advise you to highlight the beginning and end of the crumb styles, because if in the future you want to change anything there, you will get confused.

Now you need to add breadcrumbs directly to the blog.

In the blog admin we find appearance , then editor, and select single.php. Next add the following:

Important

Please note that the crumb calling function itself is located between the tags

whose id breadcrumbs-two, do not forget to change this id to the example that was added to the styles. For example, if this is the first example (which is above) then it should be like this:
and so on. (Sorry for the puzzle) :-)

If your blog template is similar to mine, in the sense that the background is gray and the content block itself is white, it’s best to place the crumbs above the block, like mine. Because they can be moved to a new line if the name is too long and, believe me, this is not very beautiful. :-)

That's all. Dear friends, if any difficulties arise, you will definitely ask in the comments. See you soon.

Lists are convenient due to their hierarchical structure and flexible view settings, so they are used not only for their intended purpose, but also for creating various page elements such as breadcrumbs, page numbering, menus, tabs, etc.

bread crumbs

Breadcrumbs help you navigate the site and show the position of the current page relative to other sections of the site. This makes it easy to move up a level and understand which section you are in now. So, for a technical site, navigation may be as follows (Fig. 1).

Rice. 1. Type of bread crumbs

The last text points to the current page and is not a link. All items are separated from each other by some symbol, usually an arrow (→), a slash (/), a greater than sign (>) and the like.

Since the design is entrusted to styles, the HTML code is very laconic. We create a list and assign it the breadcrumbs class so that the style does not extend to other lists.

Note that there are no separators here; they are displayed using the content style property (example 1).

Example 1: Creating Breadcrumbs

bread crumbs

To begin with, we reset all margins and paddings of the list and line up the items horizontally using the display property with the value inline-block . It also removes markers, so there is no need to do this on purpose. The ::before pseudo-element is required to add a separator between items and control its appearance. The text is added to all points, including the first one, which we, of course, do not need. Therefore, we remove it using the :first-child pseudo-class, which applies the style to the first element

  • .

    A large amount of material, such as site articles, is often divided into separate pages of 10-15 articles per page, which leads to a reduction in site loading. The transition between individual pages is done through their numbering, where each number serves as a link to the corresponding page. It is possible to display all pages, a certain number of them, or only links to the next and previous pages. Which option to choose depends on the site design and your preferences. One of possible ways numbering is shown in Fig. 2.

    Rice. 2. Page numbering

    To do this numbering, we again use a simple list, now with the pager class, each item in this list will be a link to the page. To highlight the current page, add the active class (example 2).

    Example 2: Page numbering

    Pagination

    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    The line between points is made through the border-bottom property for the element


  • Close