[Resolved] Need help converting code to new relationship method
This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
You are saying on live site with the following location post - it does not display any content under the section "Classes offered at this location:":
=> hidden link
Now, when I checked on the staging site I see the same - I do not see any post under section "Classes offered at this location:":
=> hidden link
And when I edit the same post - I do not see any related posts available.
=> hidden link
There are no related posts available for the post "burlington-technical-center" which is why it is not displaying.
I checked other location posts where it displays the posts under section "Classes offered at this location:":
=> hidden link
=> hidden link
When I ran the migration on the live site, it did NOT produce the same results as when you did it on the staging site. It did NOT come up with ONE relationship that was Classes Locations. It came up with TWO relationships that were totally different. That's why it didn't work for me with the code you gave me above.
I don't even know why one of my original files is now messed up on the live site after I restored the database.
I don't understand why the migration would have different results for each of us.
Now I'm going to try to merge the staging site with the original site since that seems to be my only option left.
It did NOT come up with ONE relationship that was Classes Locations. It came up with TWO relationships that were totally different.
==>
that is true - because the legacy many-to-many relationship was created using two one-to-many relataionship.
*** Please make a FULL BACKUP of your database and website.***
So, you should merge the two one-to-many relationships you see by following the above doc so it will become many-to-many relationship.
Your instructions ARE NOT WORKING. I have now merged the database from my staging site with the live site. So now it is just what you did with the same class-location relationship. Except for some reason the same classes archive file (archive-classes.php) from the staging site isn't working on the live site. Plus, that file doesn't even have the code you gave me above. When I use the code you gave me, the page doesn't work AT ALL. This is a total nightmare. It's giving me errors I didn't even have before. hidden link
I can see on your live site - it's working as expected:
=> hidden link
I just show you the method of how you can update the file - you need to update other files accordingly with a relationship keeping in mind. If you need more help please feel free to contact me.
So, let's go step by step - can you please confirm you understand what I've added to single-location.php and single location post on frontend displays the information as expected:
=> hidden link
- I see 8 related posts on frontend and the same displayed on the backend with the same location post:
=> hidden link
So, incidentally, all of my code was backwards compatible, and I spent days working on this for nothing. I'm now using the original files I had, and they all work.
Ok - but its better for the future that as you already spent time on this you should now go ahead and convert the code as per the new relationship as you may expect and it might be possible that legacy relationship code may be broken any time.
I let you decide - if you want to convert the code - I'm happy to help you as always.