Trying to simply display the category at bottom of page post

  • Hi,


    I assumed this would be simple, but here I am...


    Using PerchBlog app, I'm trying to use the category as a class name so that each post has a different look.


    What's the best way to accomplish this?


    PHP
    1. <?php
    2. perch_blog_custom([
    3. 'template' => 'blog/full_post_sort.html',
    4. 'count' => 20,
    5. 'sort' => 'postDateTime',
    6. 'sort-order' => 'DESC',
    7. ]);
    8. ?>
    HTML: full_post_sort
    1. <div class="blog-mix">
    2. <div>
    3. <div class="blog-img mix mixitem [CATEGORY] ">
    4. <img src="<perch:blog id="image" type="image" width="539" height="306" crop="true" />" alt="<perch:blog id="postTitle" />" class="resize">
    5. </div>
    6. <a href="<perch:blog id="postURL" />"><h3><perch:blog id="postTitle" /></h3></a>
    7. <perch:blog id="excerpt" type="textarea" textile="true" />
    8. <a href="<perch:blog id="postURL" />">Read More</a>
    9. </div>
    10. </div>
  • drewm

    Approved the thread.
  • You can use:

    Code
    1. <perch:categories id="categories" set="blog"><perch:category id="catSlug" type="text" /></perch:categories>


    as follows:


    Code
    1. <div class="blog-mix">
    2. <div>
    3. <div class="blog-img mix mixitem <perch:categories id="categories" set="blog"><perch:category id="catSlug" type="text" urlify /></perch:categories>">
    4. <img src="<perch:blog id="image" type="image" width="539" height="306" crop="true" />" alt="<perch:blog id="postTitle" />" class="resize">
    5. </div>
    6. <a href="<perch:blog id="postURL" />"><h3><perch:blog id="postTitle" /></h3></a>
    7. <perch:blog id="excerpt" type="textarea" textile="true" />
    8. <a href="<perch:blog id="postURL" />">Read More</a>
    9. </div>
    10. </div>