A simple way to display JetEngine relationship items with Bricks Loops

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • This video shows how to create a simple relationship between Posts and Users. The users are "Post Contributors". I then show the Posts in a Loop, with a sub-loop showing the related "Post Contributors"
    Because the related items are "Users" (WP_User), we need a function to get the fields we need. The video shows how to debug the data to have to work with and figure out what you need to display the required information.
    08:50 Figuring out what data we have to work with
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 6

  • @scarlydesigns
    @scarlydesigns ปีที่แล้ว +1

    Thanks Alan! I was the one who asked lol. I was able to accomplish this as you said by creating the relationship but with a custom post type I made. Instead of going through debugging though and figuring out the function I just simply looked for the dynamic data related to the relationship I made. For instance, I am using the relationship "users" so I check the Bricks dynamic data list that had for users. It worked with data like {wp_user_display_name}, {wp_user_id}, {wp_user_login}, and so forth, all worked well.
    Obviously, this won't work for every scenario and your method its still the best way to find out what you need to display that data. This is just people who lazy like me XD

    • @wpeasy
      @wpeasy  ปีที่แล้ว +1

      :) Not lazy, smart!
      Good to know. I did a quick search and did not find those tokens, so I just went with how I know.
      I wish YT would allow you to update videos, I would add the option.
      Thanks for the update.

  • @BGdev305
    @BGdev305 ปีที่แล้ว +1

    Honestly, one shouldn't have to know or even write function code for this. Makes me think what's the purpose of jetengine having relation 'functionality' without being able to accomplish something this simple! They could atleast allow one to use dynamic tags to pull this and alot of other data from a post object. One should not pay for Bricks.. then pay for jetengine, only to have to go through writing functions (even worse for a person who has no idea of functions / php / wp codex) just to get author's name, even on relationship loop.
    Aside from the above.. you actually went a wayyyy more difficult route for this! There's no need for any functions.. you could have simply used the Post Content Element and a single dynamic tag for Author.. done in 2 mins.

    • @wpeasy
      @wpeasy  ปีที่แล้ว

      Actually @scarlydesigns nailed it. The example relationship returns and array of a WP_User objects, not WP_Post so the bricks dynamic tag {wp_user_display_name} works perfectly.
      Fortunately in this case there is a dynamic tag which could have easily been used. However, that won't always be the case. At some point anyone wanting to build sites with dynamic data will need custom functions. That is pretty mych why Bricks has the {echo:} tag.
      Also, the JetEngine integration with Bricks is pretty new and definately not perfect. But then with testing ACF abd Metabox they also have some shortcomings. I wish there was an all encomassing perfect no-code solution, but there simply isn't.

  • @andrefranzke3882
    @andrefranzke3882 ปีที่แล้ว

    Awesome thank you very much for this useful content!
    Is JetEngine leaner than acf, what do you think?

    • @wpeasy
      @wpeasy  ปีที่แล้ว

      I'm not sure what you mean by leaner?
      I just use JetEngine because it does so many things and I am use to it. I'm sure there are things that ACF does better and things that JetEngine does better. So far JetEngine is meeting all of my needs.