TangibleInc / template-system

A template system for WordPress with content type loops and conditions
https://docs.loopsandlogic.com/reference/template-system/
6 stars 2 forks source link

orderby=date is not working on learndash_course Loop type #65

Closed ghen-arvesu closed 7 months ago

ghen-arvesu commented 7 months ago

Hi @eliot-akira , There seem to be a problem on the learndash course integration and the ACF post loop integration. Once we add the orderby=date order=asc then the excerpt and the other details are getting lost.

Here is how we used it.

         <Loop type=learndash_course enrolled=true orderby=date order=asc>
            <Template name=course-item />
          </Loop>

Template: Course Item

<Loop acf_post=course_product>
  <Set course_duration><Field duration /></Set>
  <Set course_excerpt><Field excerpt /></Set>
  <Set product_id><Field id /></Set>
  <Set product_url><Field url /></Set>
</Loop>
<Set course_has_product><If variable=product_id>1</If></Set>
<Set user_has_access><If field=course_enrolled value="TRUE">1</If></Set>
<li class="tt-list__item card">
  <div class="tt-list__item__inner">
    <div class="tt-list__item__content">
      <div class="tt-list__item__title"><Field title /></div>
      <div class="tt-list__item__description"><Get course_excerpt /></div>
eliot-akira commented 7 months ago

Thank you for the issue report, the templates are helpful to see. If I understand correctly, each LearnDash course has an ACF Post field called course_product.

To help narrow down the cause, can you try the following simplified templates and tell me the resulting output? We can see where it stops working.

ghen-arvesu commented 7 months ago

Hey @eliot-akira thanks so much for your response. We were able to solve this by noticing that:

  1. The course is not actually associated with the product and
  2. we had to reset the loop values to show the correct values
eliot-akira commented 7 months ago

Good to know! :smile: