By Peter McManus on Monday, 09 February 2015
Posted in General Issues
Replies 11
Likes 0
Views 1.3K
Votes 0
My goal is to add unqiue background-colors to my category lists.

See attachment.

For example, I opened up Chrome DevTools and added a red color gradient to "Open" category. I see that the <ul class="disucss-categories-list unstyled"> has <li class="list-item" so I added it here.

How and where do I make this permanent and unique for categories called "Open" "Lacrosse Talk" "Stringing Showcase" and "String Community". Where are these files located and how do I do it?

I am not experienced with coding, so a helpful explaination will mean alot.

thanks,
Hello Peter,

Kindly please do understand that support is beyond our support scope and we are actually assisting you out of good faith just this once. I have customized the categories.front.php file for you so that they all have a unique wrapper on it's own.

Please see the updated codes here,



You can now style each of these items using the following css selectors,

·
Saturday, 21 February 2015 00:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Peter.

can you provide us with joomla backend and FTP access so that we can check on this?
·
Monday, 09 February 2015 10:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Interested in this answer as well. I would subscribe to the topic if there were a way to do so.
·
Tuesday, 10 February 2015 14:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Peter,

There is no way around this unless you apply custom css fixes on the theme file located in /components/com_easydiscuss/themes/simplistic/categories.front.php . You could add a custom class based on the category id by modifying line 21,


<li class="list-item">


To,


<li class="list-item category-<?php echo $category->id;?>">
·
Tuesday, 10 February 2015 15:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Mark;

Does this mean I would have to then edit line 30 to
<?php echo $category->id; ?>

since the category is retrieved by "title"?

Izzan; site detials added
·
Wednesday, 18 February 2015 09:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Peter,

What my colleague means is you could add the extra class to differentiate your categories and add the custom css for that particular class. For example, when you use the above code, you will get:


<li class="list-item category-13">


so that you can use "category-13" as your custom class in your css file.


.category-13 {
color: red;
}


This is just for example.
·
Wednesday, 18 February 2015 10:19
·
0 Likes
·
0 Votes
·
0 Comments
·
NIk, thanks for the clarification.

Now I'm not entirely familiar with php. I notice that there are only one <li class="list-item"> How would I add four different list-item category classes?

<li class="list-item">
<div>
<?php if( $system->config->get( 'main_rss' ) ){ ?>
<a href="<?php echo $category->getRSSPermalink(); ?>" class="category-rss" rel="ed-tooltip" data-placement="top" data-original-title="<?php echo JText::_( 'COM_EASYDISCUSS_SUBSCRIBE_VIA_RSS' , true );?>">
<?php echo JText::_( 'COM_EASYDISCUSS_SUBSCRIBE_VIA_RSS' ); ?>
</a>
<?php } ?>

<a href="<?php echo DiscussRouter::getCategoryRoute( $category->id );?>" class="category-name fsg fwb">
<?php echo $category->title; ?>
</a>

<span class="small"><?php echo JText::sprintf( 'COM_EASYDISCUSS_ENTRY_COUNT_PLURAL', $category->getPostCount() ); ?></span>
</div>
</li>
·
Wednesday, 18 February 2015 12:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Peter,

If you notice before the <li class="list-item"> code there is a foreach operation to fetch all category and load it one by one.
http://screen.stackideas.com/2015-02-18_1347.png

Hence when you change <li class="list-item"> with the code that my colleague previously provide it will change all 4 of your categories with each unique class name.

By the way when I accessing your ftp it return me with the following error message.

Response: 530 Login authentication failed
Error: Critical error
Error: Could not connect to server
·
Wednesday, 18 February 2015 13:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

The problem I encounter with this method:


<li class="list-item category-13">


; modifying line 21 at /components/com_easydiscuss/themes/simplistic/categories.front.php

is that it changes all 4 of my categories to become the same list-item. I want to add a unique class to all four of my categories. How do I do this?

See attachment for example.
For example, I'd like

.category-13 to be background color red
.category-8 to be background color black, etc.

I've updated my login credentials.
·
Friday, 20 February 2015 12:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks so much for your concerted help, I appreciate it!

I also wanted the List-Items css to correspond with the post category toolbar. See attachment. But I was able to figure this out on my own. So for those interested I will explain.

The file to edit is frontpage.post.php

You will need to add a php code to div class="discuss-story-ft"> which is on line 148
Before

<div class="discuss-story-ft">


After

<div class="discuss-story-ft category-item-<?php echo $post->category_id;?>">


The php code is <?php echo $post->category_id;?> which is different than list-item category php code that affects the top category.

If you mantain the same css class "category-item-" your color will be the same as the list-item category.


.category-item-4 {
background: linear-gradient(to right, rgba(153,0,0,0) 0%,rgba(153,0,0,0) 1%,rgba(153,0,0,0.65) 100%)!important;
}

.category-item-1 {
background: linear-gradient(to right, rgba(0,0,0,0) 0%,rgba(2,2,0,0) 1%,rgba(188,179,47,0.65) 100%) !important;
}
·
Tuesday, 24 February 2015 01:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Peter,

I am sorry for the late reply.
Thanks for updating us back on this issue and I am glad to hear your issue is now fixed. If you have anymore question, please do not hesitate to ask us.

Thanks for sharing and hope you have an awesome day ahead .
·
Tuesday, 24 February 2015 17:30
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post