Hey everyone! I’m sure this is a simple solution and I am overlooking something here, but I have tried various methods and can’t seem to come up with the correct way to accomplish my goal.
Here is what I have set up in my EE site;
When I create a new channel entry I am tagging that entry with one of the 3 categories listed above.
Below I have pasted what I have currently got working. The bottom half after the {if:else} works perfectly fine, it’s the top part that I can’t figure out. When I click one of the links to take me to one of the specific “partners” I am getting the rendered url “http:/siteaddress.com/company/partners/category/appraisal-providers” (If the bottom half is wrong and that isn’t the right link, please advise in that area as well)
{embed="site/header"}
{if segment_3 == "category"}
<section class="section" id="partner-individual">
<div class="container">
<div class="row">
<!-- THIS IS WHAT I DONT KNOW WHAT TO USE -->
{exp:channel}
<h3>{category_name}</h3>
{category_description}
{/exp:channel}
</div>
<div class="row">
<ul>
<!-- THIS IS WHAT I DONT KNOW WHAT TO USE -->
{exp:channel}
<li>
<figure>
{partner_logo}
</figure>
</li>
{/exp:channel}
</ul>
</div>
</div>
</section>
<!-- -->
{if:else}
<!-- -->
<section class="section" id="partners">
<div class="container">
<div class="row">
{exp:channel:categories category_group="2"}
<li>
<div class="partner-icon">
<figure>
{category_image}
</figure>
</div>
<div class="partner-content">
<h3>{category_name}</h3>
{if category_description}
{category_description}
{/if}
<ul>
<li>
<a href="http://{path=%27company/partners%27}%22class=%22button" class="button button-medium">Learn More <i class="fa fa-arrow-right" aria-hidden="true"></i></a>
</li>
</ul>
</div>
</li>
{/exp:channel:categories}
</div>
</div>
</section>
<!-- -->
{/if}
<!-- -->
{embed="site/footer"}
Any help is greatly appreciated! Thank you!
A few basic things right of the bat:
{exp:channel}
<h3>{category_name}</h3>
{category_description}
{/exp:channel}
should be
{exp:channel:categories}
<h3>{category_name}</h3>
{category_description}
{/exp:channel:categories}
and
{exp:channel}
<li>
<figure>
{partner_logo}
</figure>
</li>
{/exp:channel}
should at least be
{exp:channel:entries channel="Partners"}
<li>
<figure>
{partner_logo}
</figure>
</li>
{/exp:channel:entries}
@jeremy so here is what my actual code looks like. The code before was an example;
{embed="site/header"}
{if segment_3 == "category"}
<section class="section" id="partner-individual">
<div class="container">
<div class="row">
{exp:channel:categories channel="Partners"}
<h3>{category_name}</h3>
{category_description}
{/exp:channel:categories}
</div>
<div class="row">
<ul>
{exp:channel:entries channel="Partners"}
<li>
<figure>
{partner_logo}
</figure>
</li>
{/exp:channel:entries}
</ul>
</div>
</div>
</section>
<!-- -->
{if:else}
<!-- -->
<section class="section" id="partners">
<div class="container">
<div class="row">
{exp:channel:categories category_group="2"}
<li>
<div class="partner-icon">
<figure>
{category_image}
</figure>
</div>
<div class="partner-content">
<h3>{category_name}</h3>
{if category_description}
{category_description}
{/if}
<ul>
<li>
<a href="http://{path=%27company/partners%27}" class="button button-medium">Learn More <i class="fa fa-arrow-right" aria-hidden="true"></i></a>
</li>
</ul>
</div>
</li>
{/exp:channel:categories}
</div>
</div>
</section>
<!-- -->
{/if}
<!-- -->
{embed="site/footer"}
Everything below the {if:else} from the {if segment_3 == "category"} works great and as it should (or so it seems thus far), it’s everything before hand. The actually “channel entries” for the specific partner logos are rendering correctly and on the correct pages. The problem that I am still running into is the following;
{exp:channel:categories channel="Partners"}
<h3>{category_name}</h3>
{category_description}
{/exp:channel:categories}
This shows all 3 categories and their descriptions. I only need it to show the {category_name} & {category_description} of the category it’s actually on.
Feel like sooo close!!! Help is greatly appreciated!
You’re likely looking for:
{exp:channel:category_heading channel='Partners'}
<h3>{category_name}</h3>
{category_description}
{/exp:channel:category_heading}
Documentation: https://docs.expressionengine.com/latest/channel/category_heading.html
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.