• Resolved morris373

    (@morris373)


    Hi
    I have just statrted to use Pods, I tried it last year and didn’t understand what was going on, so I used a different plugin.

    Anyway, I want to relate 2 different CPTs as they have the same field.

    First CPT: Deceased
    First Name Text
    Surname Text
    Age Number
    Address Text
    Burial Date Date
    Clergy Taxonomy
    Grave Number Bidirectional & connected to Grave=>Grave Number

    Second CPT: Grave
    Grave Number Bidirectional & connected to Deceased=>Grave Number
    Photo File / Image / Video

    Grave Template:

    <p>Grave Number: {@grave_number}</p>
    {@photo_of_grave._img.medium}
    <hr>
    <h3>Other People buried in this Grave</h3>
    <ul class="">
    [each grave_number]
        <li><a href="{@permalink,esc_url}">{@post_title}</a>
    		<ul>
    			<li>Grave Number: {@grave_number}</li>	
    			<li>Age: {@age}</li>
    			<li>Address: {@address}</li>
    			<li>Burial Date: {@burial_date}</li>
    			<li>Clergy: <a href="{@clergy.permalink}">{@clergy.name}</a></li>
    		</ul>
    	</li>
    [/each]
    </ul>

    I have set up Grave Number to be Bi-Directional/Relationship in the Deceased CPT and Grave Number in Grave CPT the same.

    Becaase there maybe more people buried in the same Grave, I have selected Multiselect but that just shows the Names of the people and not the Grave Number.

    The Grave CPT should be on the 1:Many side, so I should be alright adding all the Graves by themselves but I can’t as I have to select the people first, which is wrong.

    How can I set this up correctly please or is it set up correctly?

    Thanks

    Morris

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @morris373

    In your case you should set the grave number field on the “Deceased” pod to a singular relationship.
    The bi-directional relationship from the Grave pod should be a multiple relationship. However, since “Grave number” isn’t the best way to describe this you might want to rename this field to something like “Deceased”. This is more descriptive as to what that field relates to.

    Also, looking at your template, you use the grave_number field incorrect. As this is a relationship it won’t actually contain the actual grave number, only the deceased linked to this grave.
    I would say the title of a grave would be the grave number. Or an extra custom field.
    This is another reason I’d rename the relationship field on the “Grave” Pod. The name “Grave number” simply causes confusion about what that field contains/represents.

    Cheers, Jory

    • This reply was modified 3 years, 11 months ago by Jory Hogeveen.
    Thread Starter morris373

    (@morris373)

    Hi Jory Hogeveen

    The Grave Number relates to a separate map from the Burial Register and that is only the same data that will be linked.

    Sorry but I don’t understand what you mean by Singular relationship and Multiple relationship, is that in the Advanced Field Options? If so Deceased is set to Single Select and Grave is set to Multi Select.

    I did use the page title as the Grave Number so I have changed that part in the template.

    So am I right in thinking that once the Deceased people have been set up, I then add the names of the deceased people to the Graves?

    Before when I played with relationships I had a working Burial Register and now there’s nothing on the page, so do you have to do anything different when using relationships in the blog template?

    Thanks

    Colin

    Thread Starter morris373

    (@morris373)

    Hi
    I created a Grave 20 first and added 2 more deceased people and selected Grave 20 and then went back to Grave 20 and the deceased people were alredy connected, without even touching it. That’s great.

    I would like to order the Graves by the grave_number so my shortcode I had before didn’t work as I had:

    [pods name="deceased" orderby"grave_number ASC" template="Burial Register Template II"]

    But it doesn’t like orderby, if I take it out, the Burial Register page works.

    You have no documentation on how to use ‘Orderby’ so I am lost.

    Thanks

    Morris

    Thread Starter morris373

    (@morris373)

    Hi
    I changed Orderby to another field i.e. burial_date as in the Burial Register is in that order and not Grave Number.

    I have also managed to create an archive file based on the Clergy who performed the ceremony and that now brings back all the related Deceased people who were buried by that Reverend or Clergy.

    It would be great to have a form on a page, so that my Co Researcher can help me add all the burials but I can’t add the Clergy Taxonomy.

    Can the Clergy Taxonomy be added to the same form?

    Morris

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @morris373

    I think it would be best if you watched our introduction video to get a better idea of what is possible with Pods.
    https://docs.pods.io/videos/grow-beyond-posts-pages-introduction-pods-framework/

    On your orderby option. If it’s about metadata you should use grave_number.meta_value ASC (note the added .meta_value).
    More info about such params: https://docs.pods.io/code/pods/find/

    Can the Clergy Taxonomy be added to the same form?

    Not sure what you mean with this..

    Cheers, Jory

    Thread Starter morris373

    (@morris373)

    Hi
    When I add a deceased person from the frontend via the form I cannot add the taxonomy as I don’t know how to.

    So a deceased person is buried by a Vicar or Clergy and that is set up as a Taxonomy but I can’t see how I can add the Taxonomy Clergy to the Burial Register form.

    How can I do it, please? If I can’t then the frontpage forms are useless. I will have to go into the backend when my co researcher has added the deceased people and then add the Vicar who buried them.

    Thanks

    Morris

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @morris373

    Our frontend forms do not support taxonomies at the moment, only default object fields and our custom fields.
    If you want to support taxonomies you’ll have to have a good understanding of Pods core and PHP so you can add these forms fields manually and handle the saving process yourself.

    In any case, I get the impression (also from earlier topics) that you are not a developer so I wouldn’t advice going this route.
    We have an addon for Gravity Forms which allows you to create posts/taxonomies and add our fields to the forms.
    https://nl.www.ads-software.com/plugins/pods-gravity-forms/
    https://docs.pods.io/plugins/gravity-forms/

    Cheers, Jory

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Beginner: Relationships between 2 CPT’s’ is closed to new replies.