ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Can I pull the Category ID or Category Name from entry

March 30, 2012 6:30pm

Subscribe [1]
  • #1 / Mar 30, 2012 6:30pm

    I have looked at the documentation and have tried everything… I need help.

    I was hoping to pull the Category ID or Category Name that I have selected for a particular entry.

    {exp:channel:entries channel="products"}                              
    <a href="http://{site_url}shop/{category_id}/{url_title}">_<div id="product_list_home">_<div id="padding">_<div>_{exp:imgsizer:size src="{product_main_image}" width="100" height="100"}_{sized}{/exp:imgsizer:size}_</div>_<div id="title">{title}</div>_<div id="price">{product_price}</div>_</div>_</div>_</a>

    Can I do this?

    Thanks in advance.
    - Eric

  • #2 / Apr 02, 2012 12:20pm

    Dan Decker

    7338 posts

    Hi Eric,

    Sure thing!

    You can get this with the categories variable pair:

    {exp:channel:entries channel="products"}                              
    <a href="http://{site_url}shop/{categories}{category_id}{/categories}/{url_title}">_<div id="product_list_home">_<div id="padding">_<div>_{exp:imgsizer:size src="{product_main_image}" width="100" height="100"}_{sized}{/exp:imgsizer:size}_</div>_<div id="title">{title}</div>_<div id="price">{product_price}</div>_</div>_</div>_</a>

    Let me know if you have any questions!

    Cheers,

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases