Is it possible to set the category id in a channel entries tag based on the last segment or by another method so that I don't have to create multiple templates?

I'm trying to get this template to fly.


{exp:stash:append name="listings"}
        <div class="widget">
            <div class="whead"><h6>Listings</h6></div>
            <div class="shownpars">
                <table cellpadding="0" cellspacing="0" border="0" class="dTable">
                            <th>Name<span class="sorting" style="display: block;"></span></th>
                        {exp:channel:entries channel="members" category="{category_id}" status="Open" limit="100" disable="category_fields|member_data|pagination|trackbacks" dynamic="no"}
                            <td class="center">{member_email}</td>

{exp:stash:set name="content"}
    {exp:stash:get name="listings"}

1 Answer 1


If your url contains the proper category you can use Low's seg2cat plugin to grab the id



I'm afk from pc, you may have to tweak parse order but I've used this plugin to great affect many times for this purpose.

  • Hi stuart. I'm not sure if my current setup would allow me to do that. Right now I'm using the pages module and using a custom url e.g. example.com/us/fl/miami is there a way to do it like so?
    – user1267
    Mar 31, 2013 at 12:25
  • There shouldn't be any problem there. In your example if you wanted the last segment then you'd just use category="{segment_3_category_id}". Where you're using segment_3 to grab the category id. Alternatively you can grab the name and other properties.
    – Ian Young
    Mar 31, 2013 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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