Force the selection of a single category • WordPress Help

 maestrozo

Yesterday I discovered something that would have saved me a lot of headaches in a lot of projects and developments that I have suffered and cursed during

I mean what it costs, in a editorial environment to get editors to choose a category, and only one, to publish.

It's very easy to limit the choice of categories simply by modifying the user profiles so that they can not choose, but I always dreamed of being able to offer them among several and that they could only select one, and not several as is the default behavior of WordPress.

Well, that's exactly what plugins like Only one category or Radio buttons for taxonomies that modify the meta category box of the WordPress editor so that, instead of being able to select several you can only choose one of the existing ones, converting the selection boxes into radio buttons from which you can only choose one option from the list, as simple as that, look where you go.

What you get is to move on from this, where you can choose several categories …

 categories wordpress checkboxes selection

to this other, where you can only choose one …

 categories wordpress radio buttons

If you prefer you can create your own plugin the code would be like this:

And that's it. Look, it was simple. So nothing, if the need arises you already know how to do it, that you enjoy it.

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

Insert Player in Categories and their respective entries • WordPress Help

On a first theme on my page, like insert a goear player with automatic playback ; then I went a little further and explained how to insert a different player in pages of specific categories in WordPress the last thing left me can say that I was left with a certain air of dissatisfaction, since I could hear the corresponding player when I was on the page of the category to which I had assigned it, however, this did not happen when I visualized an entry in one of those categories and only the general player was heard.

Investigating a little more about the subject I found in the WordPress codex a function that allowed me to do what I wanted, it is the function in_category .

… we can use this function to do different things, such as inserting a header, footer or even a different design by category or page ( I think all this would be summarized using a similar function but to show a different style sheet rente according to the page where we are ) …

The inclusion is simple, we use is_home to insert a code or function that will be displayed on the main page; in_category ('category-x') to insert a code or function that will be displayed in the specified category including its entries; therefore, the previous function that we had in the following way:

This code will allow us to show a different player for each category specified and in the entries that correspond to it; for sample you can try entering the categories: death-note, naruto-shippuden and, mas-sabe-el-diablo and their corresponding entries.

I hope this tutorial has been helpful, so with a specific example we can use this function to do different things, such as insert a header, footer or even a different design by category or page ( I think all this would be summarized using a similar function but to show a different style sheet according to the page where we are ), page and even in the entries according to the category to which it belongs, just need to use a little imagination and start our projects …

NOTICE : this publication is from two years or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

Delete the category of the URL • WordPress Help

Now yes. After the hardships that we have spent these months to get to eliminate the category of the URL in WordPress I have found an infallible method with the following virtues …

I have tried it in the official blog of Media and Networks where you can see it working (in fact " blog " is itself a category with subcategories, try in any subcategory from the list of links above). Of course, it works regardless of whether you have customized the permalink structure to something else (eg: 'category' or 'section', etc.)

Just one caveat … Imagine you have a page with the url ] http://mi-web.com/noticias/ and also a category called "news". In that case, the category would prevail, so accessing the "new" permalink will always show you the category "news" instead of the page. What's more, if you have a link to that page in your navigation bar it will show you the category. Keep it in mind.

Export by categories

The other day in the forum asked a partner how could export only one category of his blog to, for example, create a new blog dedicated to this topic. And it is that by default the export utility of WordPress only allows to export discriminating by author, not by category .

Well, giving a little coconut and looking for it came to light a couple of ways to do it (if you know one more please share) …

There is nothing like the imagination to solve seemingly irresolvable problems using simple methods that are also there in front of us.

It is a somewhat slow method if you have many posts in the category, because you already know that WordPress only shows you 15 posts per page, but it is simple and effective. However, if you have thousands of entries you prefer to use the other method …

Okay, you're a beast of this WordPress and you know that everything that happens in the WordPress admin panel is there because there is a file where configured that behavior. So before this type of need you attack at the root and we start to modify 2 files that are called the same but they are in a different place: ' /wp-admin/export.php ' and ' / wp -admin / includes / export.php '. You just have to follow these instructions .

Now this system does not work in WordPress 2.7 so you can only use it until version 2.6

My categories do not appear on the blog

It's funny how sometimes the simplest thing complicates our lives and gets us worried, sometimes until to despair for our blog. Something as simple as the WordPress categories can be incomprehensible if we do not know something basic about its operation.

Well, it's not really your fault, you have not done anything wrong, you should not modify anything in the code. your template, learn PHP CSS or HTML . It is simply that WordPress allows you to create a structure of Categories and Tags but they will not be shown until you have associated them with some post.

It was just that and, as a bukito you will have a hard time now that you already know it.

How to exclude categories from the cover loop in WordPress

There are times when you do not want to show posts of certain categories in your blog either because you want to show them only in specific sections, or because they are only for one type of user, you decide the reason.

If you have ever thought about what you need to exclude posts from certain categories and that do not show in according to which places from your blog, the main page, for example, here are two ways to get it.

Ultimate Category Excluder

As always, or almost, there is a plugin to get it. Thanks to Ultimate Category Excluder you can decide if certain categories will be displayed on the main page or even in the list of categories in your sidebar. Just choose the category and check the appropriate boxes for each case.

Modifying the Loop

Of course, you can also manually modify the WordPress loop which will give you much more flexibility because you will be able to use this system to exclude categories anywhere in your blog.

To do this you must modify the "call" to the categories of posts to be shown by something similar to this example:

Where '-1' and '-2 'would be the category ID to exclude that, as usual, you can expand, reduce or change to your liking.

Adding a function that excludes them

The same but cleaner, would be to add a function like this to your customizations plugin or to the file functions.php of the child theme:

AVIS O : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

Difference between Tags and Categories • WordPress Help

I know, we have been slow to explain this crucial issue, but I myself had many doubts. But after a lot of research, experiments and a drunkenness with a hangover I have arrived at what may be the perfect explanation of the difference between Tags and Categories since not even Matt knew clarify

In the end, after much searching, it turns out that I was there, hidden in the WordPress FAQ and my hangover increased, plunging me into a deep depression. And it has not been until I got ahead of this human hardship that I fell that I have not found a moment to put the ideas in clear and explain the difference between Tags and Categories .

Is it the same Tag that tag or label and Label?

Yes. Neither capitalization nor translation affects what a tag is.

Is there any way to manage the tags ?, more can I see a list of the tags I used ?

Up to WordPress 2.5 there was no way but now you can manage your tags as you would with the categories, and if you use the plugin Simple Tags you have a lot of tools to do tricks with them.

Is there any limit to the amount of Tags that I can have?

No.

Urls

A post in the category 'food' would look something like this:
https://ayudawp.com/category/comida/

The same post, using the tag 'food' would look like this:
https://ayudawp.com/tag/comida/

A post in the category 'food' and with the tag 'rice' would be something like this:
https://ayudawp.com/category/comida/
https://ayudawp.com/tag/arroz/

Is there any advantage in using tags or categories or both? [19659005] Neither in WordPress nor in the search engines. Only for the purpose of organizing your blog.

Do I have to use tags?

No, it's totally optional.

Will Automattic remove the WordPress categories?

No, that's where they'll go

How do I change or delete a tag ?

Let's see, we're not paying attention! Do not get complicated, use Simple Tags it's a MUST-HAVE plugin if you use tags, which I hope WordPress will include it someday.

Are categories and hierarchical tags?

Categories have always been like this, being able to make categories that hang from others (daughters). The tags do not exist by themselves and do not have to be related to anything else – except in content.

I have a lot of categories, can I delete them or convert them into tags without having to edit the posts one by one?

You can delete them, of course, but posts in that category – unless they are also associated with another – will be associated with the default category. You can also convert categories to tags from the utility of your call management panel – what do you not guess? – Category converter to tags .

I've already seen that I can have as many tags – and also categories – as I like, so how many categories or tags should I have on my blog?

It's totally something personal, however my advice is to restrict as much as possible the categories, limiting them to the most common themes in your blog. About the tags is a matter of each one but an excess will not help your readers to find valuable or organized information either.

Okay, but then what is the difference between categories and tags?

Look, we see it with a example. Imagine that you have a blog about your city, and you write a post about what you eat in the different restaurants that there are. For his would be "hierarchize" that activity, food, in its own category, seen that it will be a recurring activity. Now, if tomorrow you create a post about a rice three delights that you have eaten in the Chinese restaurant in front of your house, because what you would do would be to assign the generic category 'food' and the tags 'rice' and 'Chinese', for example. Now extrapolate this example to your blogger activity.

Well mystery unraveled !, I hope you already know the difference between categories and tags . Of course, the translation is free and adapted to our times because the FAQ was already outdated, but has it served all purposes, or not?

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you: