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

General Questions/New to Joomla! 5.x • Re: Readmore Button wrong Position

$
0
0
We want
1. the article title
2. the article
3. the read more button
4. the article information

So exactly as it has been since Joomla 2 to Joomla 4
You could do this by creating a HTML override as follows:

(a) Copy the file blog_item.php that is under the directory \components\com_content\tmpl\category to the directory \templates\your-cassiopeia-child-name\html\com_content\category

(b) Edit the file blog_item.php that is under the directory \templates\your-cassiopeia-child-name\html\com_content\category

(c) Rearrange the following lines of code as shown below:

Original code:

Code:

......    <?php echo $this->item->introtext; ?>    <?php if ($info == 1 || $info == 2) : ?>        <?php if ($useDefList) : ?>            <?php echo LayoutHelper::render('joomla.content.info_block', ['item' => $this->item, 'params' => $params, 'position' => 'below']); ?>        <?php endif; ?>        <?php if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>            <?php echo LayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>        <?php endif; ?>    <?php endif; ?>    <?php if ($params->get('show_readmore') && $this->item->readmore) :        if ($params->get('access-view')) :            $link = Route::_(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));        else :            $menu = Factory::getApplication()->getMenu();            $active = $menu->getActive();            $itemId = $active->id;            $link = new Uri(Route::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));            $link->setVar('return', base64_encode(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)));        endif; ?>        <?php echo LayoutHelper::render('joomla.content.readmore', ['item' => $this->item, 'params' => $params, 'link' => $link]); ?>    <?php endif; ?>        <?php if ($isUnpublished) : ?>        </div>    <?php endif; ?>......
Rearranged lines of code:

Code:

......    <?php echo $this->item->introtext; ?>    <?php if ($params->get('show_readmore') && $this->item->readmore) :        if ($params->get('access-view')) :            $link = Route::_(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));        else :            $menu = Factory::getApplication()->getMenu();            $active = $menu->getActive();            $itemId = $active->id;            $link = new Uri(Route::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));            $link->setVar('return', base64_encode(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)));        endif; ?>        <?php echo LayoutHelper::render('joomla.content.readmore', ['item' => $this->item, 'params' => $params, 'link' => $link]); ?>    <?php endif; ?>    <?php if ($info == 1 || $info == 2) : ?>        <?php if ($useDefList) : ?>            <?php echo LayoutHelper::render('joomla.content.info_block', ['item' => $this->item, 'params' => $params, 'position' => 'below']); ?>        <?php endif; ?>        <?php if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>            <?php echo LayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>        <?php endif; ?>    <?php endif; ?>    <?php if ($isUnpublished) : ?>        </div>    <?php endif; ?>......
With the above HTML override, the blog items would be shown as below:

Before change:
blog_item_before_code_change.jpg
After change:
blog_item_after_code_change.jpg

Statistics: Posted by imanickam — Sun Nov 17, 2024 4:24 pm



Viewing all articles
Browse latest Browse all 2255

Trending Articles



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