Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1362

General Questions/New to Joomla! 4.x • Re: Add Class To Each Blog Item

$
0
0
This could be done using the HTML override technique. The following documents would be of help in understanding the output override technique. Even though some of the documents may not be for the latest version of Joomla, the concept is equally good for all versions of Joomla.
https://docs.joomla.org/Understanding_Output_Overrides
https://docs.joomla.org/J4.x:Template_Overrides

As you are referring to the Blog layout, the file to override would be blog.php that is located in the directory \components\com_content\tmpl\category.

Within the code where the class is defined/coded, you could use article id with some prefix (eg article-x where x is the ID of the article) and make it as an additional class. This will be distinct for each article irrespective of their position. The following image will demonstrate this approach.
Blog item class generated using article id.jpg

Another way would be to have a variable and increment it and using the variable's value with some prefix to create class name.

Statistics: Posted by imanickam — Sat Aug 17, 2024 5:17 am



Viewing all articles
Browse latest Browse all 1362

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>