Oncord Community Logo
    • Recent
    • Popular
    • Register
    • Login

    Post category titles and posts display logic

    Advanced Coding
    2
    2
    690
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BenB
      Ben
      last edited by

      Trying to figure out how to display the category title/name in the post display. Seems like it should be something like <h3>[? $post['post_category_title'] ?]</h3> but no variations other than 'post_category_id' seem to work (which just shows the category number).


      Also wanting to set up logic to check if there's any posts within a particular category, and if not make the section containing the posts display block not appear on the page. Something like:

      <logic:if test="CODE TO CHECK IF THERE'S POSTS IN CATEGORY 3">
      templates:section
      <p>West End:</p>
      <data:postrepeater paging="true" pagingrows="6" templatetype="list" postcategory="3" />
      </templates:section>
      </logic:if>

      Ben Johnston
      Evocative | Brand Design
      evocative.cc

      K 1 Reply Last reply Reply Quote 0
      • K
        kimguevarra @Ben
        last edited by kimguevarra

        @Ben

        We currently have a tutorial on how to list post-category values. You can check it out here:
        Show Categories for a Post

        This guide will show you how to display all the categories associated with a post. If you only want to display the primary category, you can use the following code:

        \Components\Website\Posts\Categories::getColumn($post['post_category_id'], 'post_category_title')
        

        To check if there are posts in a category, you can use this code:

        
        <logic:if test="$post">
             <p>West End:</p>

             <data:postrepeater paging="true" pagingrows="6" templatetype="list" postcategory="3" />
        </logic:if>```
        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Features
        • Website
        • Customer Database
        • Digital Marketing
        • Sell Online
        • Integrations
        Help & Resources
        • Contact Support
        • Learning Centre
        • Latest News
        • Developer Resources
        Oncord
        • Contact Us
        • Client Stories
        • Partner Program
        • Agency Login
        Legal
        • Software: EULA
        • Support & Professional Services
        • Reseller Agreement

        © 2023 Oncord. All Rights Reserved.