You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the related category mode, there is no category data returned.
{!-- Main Entry --}
{exp:channel:entries channel="news" url_title="{segment_2}" track_views="one" dynamic="no" disable="pagination|member_data|trackbacks" status="open|featured"}
{title}
{/exp:channel:entries}
{!-- Related Cat Mode Loop --}
{exp:channel:entries channel="news|events|media|briefs|partner_content|media" related_categories_mode="yes" limit="3" custom_fields="yes" dynamic="no" url_title="{segment_2}"}
{title}
{!-- This does not work --}
{categories show_group="6|7|8" limit="1"}
<a class="content-card__category" href="category/{category_url_title}">{category_name}</a>
{/categories}
{/exp:channel:entries}
Describe the solution you'd like
The category data to be returned when using the standard {categories} tag.
Describe alternatives you've considered
I have used the Query add-on to generate the query needed to pull in the category data.
{exp:query sql="SELECT `c`.`cat_id`, `c`.`cat_name`, `c`.`group_id`, `c`.`cat_url_title` FROM (`exp_channel_titles` t) INNER JOIN `exp_category_posts` p ON `p`.`entry_id` = `t`.`entry_id` INNER JOIN `exp_categories` c ON `p`.`cat_id` = `c`.`cat_id` WHERE `c`.`cat_id` IS NOT NULL AND `t`.`site_id` IN (1) AND `t`.`url_title` = '{segment_2}' AND `c`.`group_id` IN (6,7,8) LIMIT 1"}
<a class="content-card__category" href="{path='category/{cat_url_title}'}">{cat_name}</a>
{/exp:query}
This is very verbose!
Possible solution
I have seen in the mod.channel.php related_category_entries() ln, 4686 if the following is added before $this->parse_channel_entries():
if ($this->enable['categories'] == true) {
$this->fetch_categories();
}
Then the {categories} tag works as expected. Is there any reason this cannot work?
The text was updated successfully, but these errors were encountered:
When I use the related category mode, there is no category data returned.
Describe the solution you'd like
The category data to be returned when using the standard
{categories}
tag.Describe alternatives you've considered
I have used the Query add-on to generate the query needed to pull in the category data.
This is very verbose!
Possible solution
I have seen in the mod.channel.php related_category_entries() ln, 4686 if the following is added before
$this->parse_channel_entries()
:Then the
{categories}
tag works as expected. Is there any reason this cannot work?The text was updated successfully, but these errors were encountered: