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: