Coding the category color

4.00K viewsUpdates
0

Hi,

I am using a template called WP-Pravda and it pulls out contents from pages or posts on the front page, in a masonry style. Each post has a different color, depending either on its category or on a specific color attached to the post, see example here : http://demo.color-theme.com/?theme=Pravda

I am no developper but I managed to make it pull all my Anspress Questions on the front page, which is nice 🙂

Yet these Anspress Questions don’t bear the color of their category.

I was told I could add an extra-option on a file of the template, and I identified the part of the code related to it :
$of_options[] = array(    “name”        => __( “Get the custom color for posts from:” , “color-theme-framework” ),
“desc”        => __( “Choose how to define the color for posts.” , “color-theme-framework” ),
“id”        => “{$prefix}post_color_type”,
“std”        => “Post settings”,
“type”        => “select”,
“options”     => array(
‘post’            => ‘Post settings’,
‘category’        => ‘Category settings’,
 ‘anspress_category’        => ‘Anspress’

)

 

I tried adding the line in bold but it doesn’t work as I do not know how the category of a question is meant to be called in Anspress. Do you guys know what I should put here ?

 

Thanks for your answer  🙂

0

salut !

I would use css to resolve the problem. If you right-click on a post on a category page and then click Inspect* you will find at the end of this page some identifiers. If the category is Général you will see .question_category-general

Then in the style.css of your theme (preferably child-theme) you can add:

.question_category-general {background:#e6e6e6 !important; }

Replace the part “general” and the color #e6e6e6  according to the case.

Hope that helps

——————————————————————————–

*Inspecter/Examiner l’élément etc selon votre navigateur