Oncord Community Logo
    • Recent
    • Popular
    • Register
    • Login

    Post category titles and posts display logic

    Scheduled Pinned Locked Moved Advanced Coding
    2 Posts 2 Posters 2.8k Views
    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 Offline
      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 Offline
        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

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 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.