1

I am having a slight issue with grabbing data from my related categories. click here on my dev site i have several categories energy, relax, wellness etc etc. When the user click on one of the categories a blog roll is created which reveals all posts with that category. I have added the following code to my template:

<ul class="results-row">
{exp:channel:entries channel="blog" disable="member_data|trackbacks" related_categories_mode="yes" limit="4" }
        <li>
        <a href="{url_title_path='blog/full-post'}">
            <div class="featured-tab {categories}{category_image}{/categories}"></div>
            <img src="{blog_slide_image}" alt="placeholder" class="feature-preview-img"></a>
            <h2>{title}</h2>
            <p>{exp:eehive_hacksaw chars="150" append="..."}{feature_copy}{/exp:eehive_hacksaw}</p>
        </li>
        {/exp:channel:entries}
        </ul><!-- RESULTS-ROW ENDS HERE-->

However the blog roll pages remain blank, although the categories are populated. Looking at my code above can someone point me in the right direction.

1

I think the issue may lie with the presence of the related_categories_mode parameter, which is intended for a single entry view and not an entries loop returning multiple entries.

From the docs:

  When enabled, this parameter alters the behavior of the {exp:channel:entries} tag, causing it to ignore the entry ID or URL title found in the URL, and instead show a list of entries that are in the same category as the entry specified in the URL. This lets you create a list of entries that are “related” to the primary one specified by the URL.

And so your URLs in category viewing wouldn't have a single entry's url title or id, and so the loop fails to return entries. You would want to use related categories mode on your full-post template perhaps, but not on your list view.

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.