1

I have a demo installation of J 3.10.9 with protostar template (https://joomla4.extrowebsite.com/). The menu item "Home" -> blog category - has N articles. The article "Welcome to your blog" - the first - I would like to be given a different formatting than the others. "Welcome to your blog" has id = 3. I wrote this declaration in the head of the "index.php" template:

<?php $article_id = 3; ?>

<?php if($this->countModules('ModuleName') && $view == 'article' && $article_id == 3) : ?>
  <jdoc:include type="modules" name="ModuleName" style="none" />
<?php endif; ?>

With the code I posted, I see the formatting BUT it is also given to all the others, belonging to the Blog category. In the module "ModuleName" I have inserted css code. What did I do wrong with my statement? Thanks to those who want to help me.

2
  • While you wait for support/feedback, please take our tour.
    – mickmackusa
    May 18 at 20:48
  • Your example website page and description of the issue appears to be around changing the appearance/formatting of the first article but the code you have posted seems to be counting Modules. I can't see the connection or perhaps you are going about resolving the issue the wrong way.
    – Irata
    May 18 at 23:34

1 Answer 1

1

If I understand the issue correctly then I don't think you need to be changing or adding code to the template, you can do it quite simply in the Menu settings.

In the menu Item for your articles select the Blog layout and change the '# Leading Articles' to 1 and the '# Columns' to 1 also. '# Intro Articles' can be set to whatever you want.

![enter image description here

In your templates custom.css file you can add some CSS to change the look of the first item by selecting the first articles class or id and applying the changes you want according to the template you are using.

If you specifically want the 'Welcome to your Blog' article to always be first then you will need to set up the ordering of the articles correctly so that it appears at the top of the blog each time otherwise your changes will apply to whatever article is the first article of your blog.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.