0

I have been trying to create a menu item that shows all articles in category blog layout for tags. I followed webchun's instructions here:

How to show tagged items in category blog layout

(which it won't let me add more to the question because it's locked)

I got it to work, even got the read more button added (though I don't think correctly, because it doesn't check if there is a read more just automatically adds it), but what I need is to add other elements to it which are not options. I want to add the published date, the author, and the category. I know that this is an override, but I have no idea what parts to copy. I tried copying somethings from blog_items.php under my (custom) template, but it just stopped the page from loading).

2

Open taggedblog_items.php

Within your foreach loop you need to access the object variable that you desire and wrap it in html code.

For example:

<div class="foo"><?php echo $item->created; ?></div>

<div class="foo"><?php echo $item->author_name; ?></div>

<div class="foo"><?php echo $item->category_title; ?></div>

These values are based on the joomla v3.51 com_content item object, so if you are using an older version the values may be different. To check what values you need put die("<pre>".print_r($item, true)."</pre>"); within your foreach loop and try to access your site. You should see something like this.

stdClass Object ( [id] => 20 [title] => Acquisition [alias] => acquisition [checked_out] => 172 [checked_out_time] => 2016-05-16 19:34:26 [catid] => 8 [state] => 1 [access] => 1 [created] => 2016-05-03 21:32:09 [created_by] => 172 [created_by_alias] => [ordering] => 0 [featured] => 0 [language] => * [hits] => 0 [publish_up] => 2016-05-03 21:32:09 [publish_down] => 0000-00-00 00:00:00 [language_title] => [language_image] => [editor] => Super User [access_level] => Public [category_title] => Acquisition [author_name] => Super User [max_ordering] => 0 )

If the values are different then switch them out and you should get the results you want.

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.