I don't understand what's happening. I'm using the gwcode categories addon to get the category of and entry id, it works well when the entry id is present:

   {exp:gwcode_categories group_id="6" entry_id="22" depth="1"}

But when i use the url_title_to_entry_id plugin there is a problem:

  {exp:gwcode_categories group_id="6"
               entry_id="{exp:url_title_to_entry_id url_title="{segment_2}"}
               parse="inward" depth="1"}



The two categories inside the group name (id=6) are displayed instead of the category associated to the entry.

{exp:url_title_to_entry_id url_title="{segment_2} used alone display the correct entry id , so i don't understand why all the categories inside the group name are displayed. What could be the problem?


{exp:url_title_to_entry_id url_title="{segment_2} is not parsing the entry_id, so all the categories are displayed. How to parse a variable entry id, inside the gwcode categories?

  • 1
    You dont have a closing quote on your plugin. Dont know of that plugin but should use simgle quotes inside double quotes too. – stuartmcd69 Apr 6 '14 at 8:01
  • Hi Stuart, thanks !! Right, a closing quot is missing, but really exp:url_title_to_entry_id not is parsed inside an other parameter addon. I will reconsider a solution using the get post method, or in place to use the url title using the entry id in the segment, would be more easy to manage. – Stéphane Apr 6 '14 at 14:05

Not familiar with that plugin but you can try…

IF you're calling the {exp:channel:entries} tag, you could simply place it inside that tag and it'll work fine.

If you need to have it outside the {exp:channel:entries} tag you could use Stash to record it like:

{exp:stash:set name="catid" parse_tags="yes" type="snippet" trim="yes"} {!-- Save as snippet --}
{exp:url_title_to_entry_id url_title="{segment_2}"}

{exp:stash:parse} {!-- Forces to parse after stash:set --}
{exp:gwcode_categories group_id="6"
  parse="inward" depth="1"}

This code is off-the-top and may or may not work 'as-is' but the theory is sound ;)

  • Stuart, thanks for your code example. It works fine, and really Stash is very powerful, for the moment i only know the bases, so I have to improve the Stash capabilities. – Stéphane Apr 8 '14 at 12:49

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.