Forum Replies Created
-
AuthorPosts
-
Yasmine
ParticipantAnd bonus question - how do you make the taxonomies not show a "&" and just show "& - you can see what I mean in the video too!
(It won't let me distinguish between the two versions in this comment - one is & amp ; )
March 10, 2022 at 7:28 PM in reply to: How do I populate a relationship value based on the related post they select #34448Yasmine
ParticipantOk I get that. And so to answer my question - you do recommend that I create an autosave hook. So when a user selects a field post, a relationship is also established. Which means I can use the bidirectional relationship, and yet the user chooses on the front end
March 9, 2022 at 6:02 AM in reply to: How do I populate a relationship value based on the related post they select #34413Yasmine
ParticipantYes, I was indeed referring to field posts as related post. And just to clarify I was talking about the custom field option "post" that allows you to select a related post. Sorry that my terminology was confusing!
So in summary - they save in different tables - but both form a relationship that can later be queried in the traditional 1:n way.
So my next question is: Do I even need to worry about saving a relationship between a user and a CPT (in addition to the field post) - or is there no point as they are already connected by the field post? What would you advise for this scenario? Thank you.
March 9, 2022 at 5:53 AM in reply to: How do I populate a relationship value based on the related post they select #34412Yasmine
ParticipantO
March 9, 2022 at 1:27 AM in reply to: ✅Checkbox not checking when clicking checked by default #34409Yasmine
ParticipantHi Long - can't work out how to send screenshots in this chat, and so here is a loom: https://www.loom.com/share/ba1dd8f3f7f74c23ac377af4f201b9d7
The profile that is there is brand new, and so the box should be ticked:
March 7, 2022 at 5:27 PM in reply to: How do I populate a relationship value based on the related post they select #34361Yasmine
ParticipantOh ok - so I can add that to my user frontend form. Got you.
- Its possible I still don't understand the difference between related posts and relationships. But it is my current understanding that I need the relationship field to be populated, so I can display related posts.
So when a user selects the related post, I want the relationship to be established automatically. So if related_post = Europe; then relationship between user and region would then also fill as Europe. So yes, exactly, I would like to establish the relationship based on the post they select in related posts. Is this possible? I read something about WP_Query() in the documentation - would that do this?
March 7, 2022 at 5:11 PM in reply to: ✅Adding a custom field as a link to an elementor button #34359Yasmine
ParticipantHi Long, thank you for your reply. It didn't work by making it html - but I got it working with:
add_shortcode( 'make_a_mailto_email_link', function() { $author_id = get_post_field( 'post_author', get_queried_object_id() ); $user_email = rwmb_meta( 'user_email', ['object_type' => 'user'], $author_id ); $output = $user_email; return $output; } );And adding "mailto:" in the advanced 'before' field in the dynamic options in elementor.
Thank you for your help though! Really happy this ones done!
March 6, 2022 at 6:19 PM in reply to: How do I populate a relationship value based on the related post they select #34342Yasmine
ParticipantThank you for sharing that. It is clear how to add it to the frontend.
But having it as a separate form makes it a bit clunky - with there being two submit buttons on same page, or having it split over two pages..
Going back to my original question - is there a way to auto populate and save the value of the relationship depending on the related post that the user selects?
March 6, 2022 at 6:02 PM in reply to: ✅Adding a custom field as a link to an elementor button #34340Yasmine
ParticipantOk, I have been trying to work this out for a while. I don't understand how the short code API should be applied. And should the collected email custom field be an email format, or is it better if it is text?
add_shortcode( 'make_a_mailto_email_link', function() { $author_id = get_post_field( 'post_author', get_queried_object_id() ); $user_email = rwmb_meta( 'user_email', ['object_type' => 'user'], $author_id ); if ( empty( $post_id ) ) { return ''; } $output = ( 'mailto:'; $user_email ); return $output; } );`
Am I along the right tracks? And what do I need to do to make it work?
March 4, 2022 at 12:08 AM in reply to: How do I populate a relationship value based on the related post they select #34279Yasmine
ParticipantThere is also a loom video that you include on your last post. I can't access this, but videos really help me to cut through the jargon. Would you mind resharing it?
Also, for the record. I have currently created a relationship from university to user (as there can be many users within a university, but a user is only associated to one university) - is this the correct direction?
March 4, 2022 at 12:00 AM in reply to: How do I populate a relationship value based on the related post they select #34278Yasmine
ParticipantHi Long,
Really after some advice - as you already helped me with a shortcode to display a related post, and would ideally keep it as is. But it was my understanding at the time that it would be possible to establish the relationship from their selection. Is there any way to just populate the relationship field depending on the related post they select?
I saw something about dynamic population. Could that be a solution for this case or would you advise otherwise?
University is a post. To clarify what I am trying to do: I would like the user to choose and be connected to a CPT (university). The post type university would then show the users connected to it. Eventually the university will be connected to another CPT called country. I would then like this 'country' to also be connected to the user. So that on another CPT where the user submits research, it will show their associated university and country. And clicking through to the country will show the universities of that country, then clicking through to each university, will show its associated academics. I have done nothing additional than create a relationship between user and university.
The thread you have linked me to has a lot of information, but I still don't understand. Where do I add the
[mb_frontend_form id="{$relationship_id_AB}_relationships_from, {$relationship_id_BC}_relationships_to" post_fields="title,content" post_type="B"]shortcode into my form? I would like it to be in the same form as my other form questions - or is this not possible? If it is, how do I add a metabox post relationship field with select 2 selection?Thank you
Yasmine
ParticipantThank you
Yasmine
Participant+1
I have been doing this with CSS - but it would be easier if there was a custom setting to add onto the custom field. Thank you!
Yasmine
ParticipantIt works perfectly, no errors, and the image is pulled in. I spent hours on that, reading and experimenting with no avail, thank you. I really appreciate it.
Yasmine
ParticipantI think the is the request for 'full_url' --> is there something else I can use here?
Or do you have some alternative code? I found some a long time ago on the internet that worked perfectly without this error, but I mistakenly overwrote the code, and now can't find it again online
-
AuthorPosts