Hi,
Unfortunately css does not know what category it is coloring. You can only color an element. If you wish to color a particular element with a particular color you have to use a css selector that targets that particular element.
http://www.w3schools.com/cssref/css_selectors.asp
for example on this block1: http://screencast.com/t/AZEgaCl8joEN
.td_block_id_132895618 .td_module_mx5 .td-big-grid-meta>a{
background-color:red!important
}
.td_block_id_132895618 .td_module_mx11 .td-big-grid-meta>a{
background-color:green!important
}
But css does not know which category is displayed. If another category is displayed in that particular element you colored, it will also have that color you set.
Css is not dynamic like that.
On the other hand. You can copy over the function i showed you in a previous reply and replace it with the function from td_module.
The function to get_gategory is a big one. It starts at function get_category() { on line 177 and goes all the way to line 267 after return $buffy. You need to copy this whole code from: http://screencast.com/t/v5zSRpvR
and copy it to td_module replacing the get_category function there: http://screencast.com/t/Khkp9xlu0m
As a result you will have the color from the theme panel set to the category tag on modules but at the same time it will pick up every category the post has as parent: http://screencast.com/t/gFLrJld6
So, as a bottom line, your problem cannot be resolved by either methods as the css one is not dynamic and the php one pulls all categories to the block.
You will need custom work to get it exactly as you wish, with only one parent category and colors at the same time.
I hope this sheds light on the subject.
Thank you!
Thanks for the help. Performing those last steps do produce the output that I am expecting, however it also shows all of the other categories that are assigned to each post. Not just the parent category. I manually went through and set the parent category for a bunch of the posts, but it still shows all of the other categories as well. Is there no way to prevent that behavior?
Hi,
Unfortunately for the code i provided, it grabs all the categories. As i stated above: “your problem cannot be resolved by either methods as the css one is not dynamic and the php one pulls all categories to the block.
You will need custom work to get it exactly as you wish”
Please hire a freelancer to adjust the code in order to display only primary category.
Thank you!
Seems like everything that sold me on this theme was undone by the 6 update. All these things I could do with version 4, but now all these features that I wanted aren’t working anymore. Not happy.
Hello,
We are sorry for the inconvenience. The code was changed so we can improve our theme. We wanted to bring more features for the next versions so the code got more and more complicated. This is a side-effect of adding features. The theme gets heavier and more complicated.
Thank you for your understanding.
Here we go again. After upgrading I lost these customization’s. I tried to follow the previous instructions
“The function to get_gategory is a big one. It starts at function get_category() { on line 177 and goes all the way to line 267 after return $buffy. You need to copy this whole code from: http://screencast.com/t/v5zSRpvR
and copy it to td_module replacing the get_category function there: http://screencast.com/t/Khkp9xlu0m
As a result you will have the color from the theme panel set to the category tag on modules but at the same time it will pick up every category the post has as parent: http://screencast.com/t/gFLrJld6”
But they no longer work. So how can I accomplish this now with the latest theme version???
Hello,
Please use this code: http://pastebin.com/2yaGiCXK It is the whole file. Delete the code from your td_module.php and replace it with this one!
Thank you!
Thanks but when I do this, I get the following error, I’m not certain, but it looks similar to the one I was getting yesterday.
Parse error: syntax error, unexpected 'class' (T_CLASS) in /home/aftercre/public_html/wp-content/themes/Newspaper/includes/wp_booster/td_module.php on line 1
Hi,
What version of the theme are you using? I tested it in version 6.6 and 6.6.1 and it works fine.
Please make sure you copied the whole content and did not leave anything behind. You are getting a syntax error on line 1 which is the very beginning of the document.
Try to copy the code from the raw paste data on the bottom side of pastebin.
Let us know how it goes.
Thank you!
Yep, it’s working now. That was strange. The last time I used the “copy text to clipboard” button, I guess that doesn’t work like is sounds like it should. Thanks!
-
This reply was modified 10 years by
ned4spd8874.
And here we go again…
After updating to the latest version I’m having these problems again. I’ve tried every way possible to copy/paste that code again and no matter what I still get the error:
Parse error: syntax error, unexpected 'class' (T_CLASS) in /home/aftercre/public_html/wp-content/themes/Newspaper/includes/wp_booster/td_module.php on line 1
Ideas?
EDIT: Tried one last thing of downloading the raw paste data and renaming that text file to td_module.php worked. Confusing, but whatever, so long as it’s working.
-
This reply was modified 10 years by
ned4spd8874.
It’s been a while…
So I’ve been way behind on versions for a while, but recently made a bunch of changes and updates, including getting everything running on the latest versions.
Anyways, I’m back to having this problem again. I’m currently running version 12.6.8, is there any way at all to get this up and working on this version?
In the older version I was able to have certain category text on the front landing page show as a certain color, much like the posts have currently. I would like to have that back if possible. Here’s a couple examples, first the non-colored front page and some colored post pages.
Front landing page:
Post example 1:
Post example 2:
-
This reply was modified 1 year by
ned4spd8874.
Hello,
Please check this topic https://forum.tagdiv.com/topic/how-to-set-different-text-colors-for-each-category-globally-in-flex-blocks/
Thank you!
