What are categories in WordPress. How to Display a Category Description in WordPress

What are categories in WordPress. How to Display a Category Description in WordPress

18.08.2023

At a favorable rate will satisfy your needs.

Hello! For some reason, many people close categories in WordPress from indexing (by the way, check if your categories are not indexed using the file ). The thing is that duplicates are allegedly located in the headings. If we go to any category of my blog, we see something like this:

As you can see, they really display excerpts from articles. This creates non-unique content in WordPress categories. Therefore, many close such pages from indexing. I think this is fundamentally wrong. We are losing "that" sweet pages that are full of "weight" gained from internal links. We remember bread crumbs:

And don't forget about the menu:

Missing such "goodies" is stupid, especially for commercial sites. These same sections on the site are ideal for promotion. In this tutorial, I will show you how to use the potential of your categories. We will learn:

  • how to write metadata for categories;
  • how to place unique text in categories.

For starters, of course, you're looking for keywords for all of these landing pages. If someone has problems with this, I recommend learning how to select keywords, why drive in metadata, etc. in the lesson "".

How to write metadata for categories

In fact, everything is simple. We just need to install the best SEO plugin - . After installing and configuring it (how to set it up correctly, I told in the lesson at the link above), go to "Admin -> Posts -> Categories -> Any Category".

  1. This sets the Title for the rubric.
  2. In this place we set Description.
  3. Keywords are written here.

How to Display Unique Text in WordPress Categories

Inserting code in a theme file

We also need the text to be placed only on the first page so that there is no duplication.

Open the archive.php or category.php file (that is, the file that is responsible for displaying categories), look for the following code there:

And after it (if you want to place it after the output of the records), we insert this code (I took it from here):

Accordingly, if you want to display your text before the articles are displayed, then we place this code before the post output cycle. If the code that I suggest is not found, try the "poke" method.

Text placement

The text itself is also very easy to place. We go back to "Admin -> Posts -> Categories -> Any Category" and there we find the "Description" section. Fill it in and see the result:

Save and view the result (just go to any section on the site):

Here, of course, you need to "play around" with styles, make an appropriate background. You can place text before displaying posts, experiment with code placement. For some cases, the first option is suitable, for some the second.

The complexity of posting an article is that you need to write the text in "naked" html mode. Below is an example, notice how the h1 heading is displayed as a link:

And again, for those who experience difficulties with writing text in this form, we simply create a new post in the admin panel, save it as drafts (no need to publish it), write everything there in normal mode and switch to html mode, copy our code there and paste it into the category description. That's all.

And one more thing: I sometimes had to add shortcodes to these texts displayed in the headings. To display them, just paste this code into functions.php:

Add_filter("term_description", "shortcode_unautotop"); add_filter("term_description", "do_shortcode");

As you can see, displaying a description in WordPress categories is very easy. I have been implementing this on client sites for a long time, it's time to get to my own. Oh, how many texts you need to prepare. 🙂

There will be problems - write! We will decide. All the best!

A typical example of the use of rubrics is the materials in this course. Each instruction refers to one or another category of materials. And together they make up the structure of the site.

You can almost immediately find the instruction you need just because there is a list of headings on the left, which makes it clear what is in it.

Let's take a look at working with rubrics! 🙂

There are two ways to create a rubric. The first is a quick one, the second is longer, but detailed, with a choice of different options.

I always use the first option first to quickly create the structure of materials on the site, and then I edit the existing headings, add descriptions and other useful things to them.

Option 1

When creating a post, you may find that out of all the categories you created earlier, you may not be the one you need. For example, I want to add module 10 to the current course and make several internal modules in it.

Let's say that the module will be called "10 Questions and Answers".

I can go the simplest way and use the "Categories" widget in the post creation interface:

In our case, there is no tenth module, so we need to create it first. To do this, click on the link "Add a new category" and see the changed interface:



Great! The new rubric will automatically appear in the tree structure and be selected for use:


Now it remains for us to remove the unnecessary heading “Project News” and save the current record that the changes have taken effect. Simple and fast!

There is only one problem here - if you write the text in Russian (and this is how it will almost always be), then the links in the address bar of the browser will also be in Russian, but here is the problem ...

Let's consider its solution in the second option for creating a rubric.

Option 2

WordPress has a separate interface for managing categories. It is located in the menu "Posts" - "Headings" and consists of two parts.

Overview of the rubric adding interface

The first part is responsible for creating new categories, linking them to parent posts, specifying and other settings:


Overview of the interface with a list of categories

The second part is a table-tree structure with a set of previously added headings, in which you can change the existing ones or delete them:


How to change a rubric

When you click on a category name in the category list interface, you will automatically be taken to the editing tool.

It is the same form as in the add interface. Fill in the required fields and click on the save button.


How to delete a category

I warn you right away - the rubrics are deleted instantly and it will be impossible to restore them. Baskets (as in posts and pages) are not here.


Problems and Solutions

Here I will gradually add a solution to possible problems when using rubrics. In the old version of the course, users regularly ask questions that they do not want to ignore. 🙂

I don't see the category block in the post

It happens that the Rubrics block is not displayed in the interface for adding or editing a post. It turns on very simply - we find the "Screen Settings" button in the upper right corner:


And then check the box next to the "Categories" value:


All! Now in the right area of ​​​​the screen under the “Publish” block, the “Headings” block you need will appear. Enjoy! 😉

Conclusion

Under no circumstances should you refuse to use rubrics. By grouping posts into categories, you provide a very convenient way to read only specific topics on your blog.

If I am only interested in Hungary in your travel blog, then I will go to the section of this country and will eagerly study the instructions you have written. If Bulgaria interests me, then everything is the same.

If I didn’t tell you enough about the rubrics or if you have any questions, write in the comments and we’ll discuss it together. Perhaps it makes sense to supplement the instructions. 🙂

If you find an error, select a piece of text and click Ctrl+Enter.

Share the link to the manual with your friends!

And hello again, friends, as you can see, I began to write more or less regularly, I hope the PS will love me again for this. Oh dreams, dreams, oh well. Today we’ll talk about such an important moment as how to make headings in WordPress, in parallel we will consider the questions of what they are and why we need them.

What are rubrics

If we turn to a large encyclopedic dictionary, then we can read there that:

As you can see, this concept was developed precisely from the printing business. In the context of this article, this is a certain category containing material on the same subject. In fact, this is a section filled with the same type of information. You can also, among other things, say that this is an element of taxonomy.

Before creating rubrics, it is necessary to unequivocally decide on and think over the semantic core. Often rubrics are the most popular HF or MF queries, in the core.

I don’t know if I’m doing it right or not, but I form the semantic core as I write articles, I don’t have a clear plan. And I also do new headings as new topics arise that could be combined in meaning. This is due to the fact that in my articles I describe my personal experience, and it is formed consistently, depending on the direction studied. Nevertheless, I still keep track of the key queries that I use in articles.

Why rubrics are needed

In a previous article on how to create a WordPress menu, the issue of site navigation was touched upon. We decided that the menu is one of the ways of this very navigation.

Probably, you can write a whole article or a course of lectures on the topic of navigation. Joke. By the way, Wordstat says that people are a little interested in this topic, so anything is possible.

But still, it should be recognized that their main purpose is to group information according to meaning.

How to make headings inWordPress

So, let's move on to practice and head to our console to the menu item "Posts", "Categories" and, as usual, we get to the page that is responsible for this direction.

As you can see, on the right we already have one section called "News"

I want to draw your attention to the fact that it is created by default and cannot be deleted. You can change the name, but you can't delete it. We can say that she is the most important here. The fact is that when you delete any other rubric, the entries from it are not deleted, but are transferred to the main one. Now I understand why it can't be removed, right?

Headings, as well as menus, can be nested into each other, i.e. one can be a child of the parent. I did not check the nesting depth, because there is no need, but they say it is unlimited.

Let's move on, let's say we have decided that we will write about creating blogs using WordPress. Great, good choice. We will also write about promoting blogs, making money on the Internet, about something interesting in general, about ourselves, of course, and some important news or announcements must be present. The trick of the blog will be that we will paint our personal experience in these areas.

Thus, based on this information, we create the following rubrics:

It's my life

Here we write about ourselves, about our achievements, hobbies, personal life. Write about everything that you think is necessary to tell people about yourself.

Wordpress

Here we write everything about CMS WordPress. How to set up, how to install, how to improve, etc.

Blogchronicle

Actually, a consistent presentation of information about the creation, promotion, monetization of the blog.

WP Protection

A very important and extensive topic that can and should be singled out in a separate category.

News

The latest, the most urgent, the hottest news, announcements, I don't know, everything that requires immediate attention.

Plugins

Everything about WordPress plugins. Reviews, personal experience, some new features in plugins that no one paid attention to, etc.

This is interesting

Here we write about what you think is interesting and worthy of attention. Maybe it will be your hobby, or you did something or figured out something and wanted to write about it. Of course, we try to write for the right keywords. No need to write "nowhere"

Now we create these rubrics physically. I remind you that we are in the "Rubrki" menu. On the left we see the inscription, “Add a new rubric” and the “Title” field. In this field, write the name for our rubric “It’s my life”, for example, and at the bottom click on the “Add new rubric” button. Everything is ready.

We do these manipulations for each category that we came up with. That's all the list is ready.

Please note that the label field is filled in automatically with Latin characters. This is important because the category name is also included in the URL.

Also, pay attention to the fact that the list of categories will not be visible on the main page until we add a record (article) there.

Here you can also delete categories in bulk using the "Actions" drop-down menu. To do this, check the boxes for those categories that are to be deleted, select the "Delete" item from the drop-down menu and click on the "Apply" button.

How to make a child category

Making a rubric a child is easy. We move the mouse cursor over the already created one and select the “Edit” item in the pop-up menu and in the “Parent” drop-down menu, select the name of the category that will be the parent of our current one. Don't forget to save.

How else can I add a rubric

That's all for today, I'm sure now anyone can explain how to make categories in WordPress. If you have questions, suggestions, wishes, additions, you are welcome in the comments. You can subscribe to updates below.

By the way, on one blog I saw this inscription.

Just some kind of witchcraft 😀 Bye, bye.

How important are category pages on your site? Or did you not think about them until you stumbled upon this article? What are they - dull and uninteresting? Just imagine - they can be more useful (for both you and your visitors)! Isn't it possible to make them a little cooler, like the macho from the picture below?

If you're a regular WP user, chances are your category pages are in the same state as they were when the site was created. More than likely, they simply contain links to your posts, presented either in the form of quotes or in full.

It's possible that they look like the category page in the default Twenty Twelve theme.

Taking Category Pages Seriously

Why don't we take more care of the category pages? Why not make them a kind of introduction to the issue under consideration - i.e. topic of your section?

Instead of the standard list of links, you can do something like this:

Or something like this, a little simpler:

After all, it will be much more convenient for your visitors! Have you thought about the fact that these category pages are great for building links and gaining the “love” of search engines?

How to diversify the category page

The examples above show some of the layout options that offer additional options to site visitors. You can easily build something like this yourself, and in this article you will learn how to do it.

If you have ever customized or edited a category in WP, then you have probably seen that the page has a "Decription" field.

Most themes are already set up so that whatever you enter in the Decription field will appear at the very top of the category page.

If this does not work in your theme, you can easily enable this feature by placing the following code in the category template - category.php. If your theme does not have such a template, then use archive.php.

Total improvement of the categories page

Although the category description field accepts HTML code, allowing you to do interesting things, there is a more advanced way to completely change the category description - just use the CategoryTinymce plugin, which will add an additional WYSIWYG editor to the Decription field.

The WYSIWYG editor allows you to easily style the description area on the category page to give it the look you want. And, perhaps, one of the highlights of the plugin is that you can easily insert shortcodes of any other plugins.

So, for example, you can easily insert a slider at the very top of the page using the appropriate shortcode. You can add a set of tabs, as shown in the example above.

In the same example, you can see that there is some text next to the tabs. I was able to get these two elements side by side using column shortcodes, splitting the area into two zones - one for tabs (about two-thirds of the page) and one for text (one-third of the page).

Immediately below the tabs, of course, there is a photo gallery. You can also add images, videos, links, whatever you want.

With a little imagination, you can turn category pages into real landing pages. In addition, this path is quite good in terms of SEO.

Important Notes

1. Shortcodes

For various reasons, some shortcodes (including photo galleries) refuse to work in the editor. True, there is a solution for this.

Place the following code in your theme's functions.php file:

Add_filter("category_description", "do_shortcode");

Another possible issue is that some buttons for shortcodes are not displayed in the editor. If this happens, you can simply open a new post and do all the necessary actions there, then copy and paste the received code into the category description field.

It is necessary to focus on the fact that when a certain number of entries are displayed, the heading pages will receive navigation, that is, they will be divided into subpages. The problem is that your description for the categories page will be repeated on every subpage. Naturally, you do not need this, so we will show you the way to prevent such a recurrence.

Open your category template (category.php) and put in it the code responsible for displaying the description (the base output of the description should be in the middle):

Paste the code here to display category descriptions

Remember, we pointed out that calling a description for a category usually looks like this:

However, it may vary slightly depending on the theme you are using.

In the default Twenty Twelve theme, for example, this code has a slightly different look:

And here is how the finished code will look like, which will need to be inserted into the category.php for the specified theme:

3. All this works for labels too.

The final touch is that this technique also works for labels. Thus, if you have important label pages, you can rework them a bit. Good luck in this field!

WordPress has a very good ability to group several posts into categories (categories) to make it easier for readers to view all the articles of a certain topic that are available on the site. However, the pages of these categories cannot contain at least some useful information about the content contained in them. And this is not only bad in terms of site usability, but SEO optimization too.

Of course, you can try editing the theme files to display categories on your own pages or add content to existing ones, but if you don't have the appropriate skills, then this will be a very difficult task. Fortunately, you can solve this problem in another way, using the List Category Posts plugin, which allows you to display the content of any category, anywhere in your WordPress site.

The principle of this method is very simple, you get a shortcode with a lot of parameters that you can insert into a WordPress page to display the content of certain categories on it and add your own content to them.

At the same time, the shortcode parameters give you options such as:

  • Add pagination;
  • Specify the number of characters for post announcements;
  • Use custom CSS classes for styling;
  • Show post previews
  • Set the sorting of posts and much more.

In addition, you will have a special WordPress widget that can be used to display the content of certain categories even in the sidebar.

How to do it

With this plugin, displaying a category on any WordPress page is a breeze. You simply create a new page, fill it with the content you want, and then add a special shortcode. In it, you need to specify the ID of the categories that you want to display. It looks like this:

In addition to the ID, you can also use a title or label, in which case the shortcode will look like this:

Once you select the desired category and save the page, the content of the corresponding category will appear on it as an unordered list of WordPress posts, where each post will have a title and a link to the full post.

How to add more options

Of course, such categories do not look very attractive, but this misunderstanding can be corrected by using additional parameters that allow you to change the output of posts. There are quite a few of them, you can see the full list during plugin installation. For now, let's only look at the ones that might be needed first.

For example, you might want each post to display a thumbnail, title, and summary. Also, you may need to display several categories in one place. Then the shortcode will look like this:

As you can see, you can set multiple values ​​for a name or identifier by simply writing them through the "+" operator. And by putting "yes" to "thumbnail" and "excerpt", you can show thumbnails of entries and small announcements, respectively. At the end, the "excerpt_size" string indicates how many characters the announcements should have. In this case, announcements will consist of 50 characters, but you can specify any number.

Now, let's try to add pagination and limit the number of entries displayed at one time to 6. Also, they can be ordered by sorting the list of entries in descending or ascending title in alphabetical order. It is done like this:

As an example, this time we will use identifiers. Next, enable pagination and enforce a limit of 6 posts per page using "numberposts". At the end, we will set sorting by title in descending direction.

These are just a few examples. If you carefully study the list of shortcode features, you will understand that it allows you to do almost anything. Flexibility is the main advantage of using this plugin, so it is very convenient to display categories through it on a custom WordPress page.

Stylization

In the shortcode parameters, in addition to various display methods, you can also set your own styling. In general, by default, category content is in a list with a "ul" tag, a "lcp_catlist" class, and a unique ID. This may be enough to simply set the desired styles in your WordPress theme's CSS file. But, if you want more customization options, then you can use the appropriate options options to add your own HTML tags.

For example, you can wrap your post titles in an "h4" tag and add any class to them:

In addition, you can add a tag or class to other parts of the content as well. Here is the full list of options:

autor_tag, author_class, customfield_tag, customfield_class, catlink_tag, catlink_class, comments_tag,
comments_class, date_tag, date_class, date_modified_tag, date_modified_class, excerpt_tag, excerpt_class, morelink_class, posts_morelink_class, thumbnail_class, title_tag, title_class

If even this is not enough for you, then you can use the plugin's built-in templating system. Unfortunately, the description of this method is beyond the scope of this article, but its essence is that you will need to create a template file, paste it into your WordPress theme folder and customize it. Then, you can use the "template" parameter, which will determine which template to use in a particular shortcode. For example, you can find the default template located in the plugin folder and see how it works.

Categories in the widget

Another way to display the content of certain categories on a WordPress site is to use a special widget included with the plugin. It can be found in the Widgets section of the Appearance menu in the admin panel.

Find the "List Category Posts" widget there and drag it to the desired panel. After that, you will see a list of options to customize its output. This list contains many parameters that are also used in the shortcode, although not all of them. In any case, they are quite enough to personalize the widget as much as possible.

Conclusion

As you can see, implementing a category display on your own WordPress page is quite simple if you use this plugin. It has a huge number of possibilities, but this does not create difficulties for its use. Of course, you can do without extensions at all if you display categories using PHP code in theme files, but this method not only requires certain skills, but is also quite time consuming. In addition, unlike the plugin, the output through the code has some problems with pagination, the solution of which also takes time, nerves and knowledge.



© 2023 globusks.ru - Car repair and maintenance for beginners