Skip Navigation

[Resolved] post relationship between blogposts and cpt breaks the add blogpost function.

This support ticket is created 6 years, 12 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 8 replies, has 2 voices.

Last updated by Beda 6 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#516042

Hello,

i was trying to setup a custom post relationship between a custom post type and the blogpost. the custom post type should be the parent of the blogposts so that every custom post can be the author of a post. i can set it up by defining it in the post type settings on both types. but if i try to add a new blogpost afterwards i get this error.

Fatal error: Uncaught Error: Call to undefined method WP_Installer::d not be stored in "Select child fields from Child to be displayed in Post Relationship table"</li> <li>Fixed options of unsaved checkbox / select / radio fields weren't sortable.</li> <li>Fixed an issue when adding a existing field to another group.</li> <li>Fixed an issue with cursor that was moved automatically to the end of slug input.</li> </ul> <h4>1.9</h4> <ul> <li>Release date: 2016-02-17</li> <li>New: Taxonomy term meta (custom fields for taxonomy).</li> <li>Major upgrade to user interface.</li> <li>Renamed "Custom Fields" to "Post Fields".</li> <li>Added post arguments "show_rest" and "rest_base" to options on post type edit screen.</li> <li>Added ability to rename built-in post types "Posts", "Pages" and "Media".</li> <li>Added new filter "wpcf_exclude_meta_boxes_on_post_type" that allows to exclude own Post Types from wpcf_add_meta_boxes() function in order to avoid adding Types met in /home/leaving2/public_html/wp-content/plugins/types/library/otgs/installer/includes/installer.class.php on line 481

i would very much apprechiate your help.

thank you,
Gerhard

#516161

1. I set up a new Post Type with the Toolset Types plugin:
- Toolset > Post Types
- Create (save) new Post Type
- In the "Children Post Types:" section I select "Posts" and save again

2. I create a few Parent Posts (above-created Post Type) and a few posts

3. I connect them

Everything works perfectly smooth.

The error you see cannot be happening this way, as it's not an Error notice, but it seems a changelog content. This is very strange. Also, the Fatal Error appears malformatted, there is no Method "WP_Installer::d" in the entire WordPress install if Types is active.

Are you sure the error you copied is the error you see?

Can you elaborate the exact steps you need to follow to get that mistake?

Can you try this with a fresh copy of the Toolset Types plugin, no other Plugins and a native WordPress Theme or our Toolset Starter Theme?

Thank you for reporting back.

#516190

Hello Beda, thank you so much for your response. It was the error message and i solved it by switching to php 7.0 which is not ideal, because there are other errors coming up. I am having a lot of issues with php, caching on siteground and probably compatibilities with all of them in combination with toolset and Avada. At the moment i cant access any post or cpt, because of an error message like that.

Fatal error: require_once(): Failed opening required '/home/leaving2/public_html/' (include_path='.:/usr/local/php70/pear') in /home/leaving2/public_html/wp-admin/includes/admin.php on line 23

i guess that doesnt have anything to do with toolset, but thank you kindly for your help.

#516235

Hello, the relationships seemed to work, but now i am facing a pretty bad problem.

I setup a relationship between a custom post type as the parent of posts to make the custom post type the author of the post. It worked so far, but the assigned posts showed up on the right custom post, but also on another one. I then removed them from the original post and now my two posts are just gone. they are not there anymore.

#516237

in the frontend the connected posts are still linked and showing up in the custom post type. in the wrong one, that they were never supposed to be in. of course i cant open them because they are not there anymore in the backend and on the blog.

#516245

Okay, i got it now. The delete button on the child deletes the post and not the relationship with it.

i deactivated the relationship between the two now and tried it again and now it seems to work.

is it right, that i have to setup the relationship from the parent post and not from the child? because if i try to set it up from the child it doesnt save.

i also wanted to ask if php 7.0 is supposed to work fine with toolset. because i am having a lot of issues at the moment and i can only get it to work with 5.6

#516408

1. Toolset works with any PHP version from 5.3 up to the latest 7.x versions
https://toolset.com/toolset-requirements/

There are no Bugs, I use it myself successfully.

2. I setup a relationship between a custom post type as the parent of posts to make the custom post type the author of the post.

I have to interrupt here. There is something I do not understand.
"to make the custom post type the author of the post".

Custom Post Types are no authors. Authors are Users.
Something is confused here.

Please, can you elaborate what you mean with Author? Authors are users, and users cannot be in a relation of parent/child to posts.

3. Okay, i got it now. The delete button on the child deletes the post and not the relationship with it.

Yes, correct. It deletes the post AND the relationship of course.

Types stores the Parent Post ID in the Child Post, in a Field called _wpcf_belongs_{parent-post-type-slug-here}_id
When we delete the Child Post, that Field is gone as well, no relationship exists anymore.

4. is it right, that i have to setup the relationship from the parent post and not from the child? because if i try to set it up from the child it doesnt save.

It does not matter, it is simply a different approach.

- If you create a Child Post, you can CHOOSE from a select Field the Parent Post it should be assigned to.
But, you cannot CREATE a Parent Post, from within the Child Post edit screen.
- If you create a Parent Post, you can CREATE new Child Posts, but not SELECT any Child Post from within the Parent Post Edit Screen.

You can create as many Child Posts of the same type you want, but always Select only one of the same type, for each Child

I think there is some confusion on the topic.

Please read this DOC carefully, to see if Post relationship is really what you need for your setup:
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/
https://toolset.com/documentation/user-guides/creating-post-type-relationships/

If you think it would be helpful to get some special kind of support, I suggest to request a Call, we could have a live call with you and remove a few doubts perhaps?
https://toolset.com/toolset-support-policy/ask-support-video-call/

#517747

Dear Beda, sorry for the late reply and thank you for your help and the offer to get video support. I appreciate it very much!

1. I did a lot of experiments these days and was able to solve something and narrow it down. I installed Framework Reference installer and module manager and it changed all the weird errors to a 500 error. so i guess it was about some corrupted files from module manager. If module manager is activated there is only the 500 error. is that possible?

I found out that the 500 error has to do with Avada and Toolset. I can activate one of them, but not both. Both of them result in the 500 error when trying to edit or create a new post. But no more strange errors.

2. Sorry for not explaining this properly. you can have a look at the site.

hidden link

so i have a custom post type Couchsurfers and these Couchsurfers should be authors of posts. but they also need views and content templates and such. Long time ago i tried to do it with users and i would prefer to do it like that, but i figuered that it would not be possible, right?

I would prefer to do it with the wordpress Core users, because that would allow me to leave the blog archive like it is.

i figured if i continue like that i will build a custom post archive for the Blog to be able to have the Couchsurfers as authors in the posts. is that the way to go?

the post relationships work fine now. i know how it is supposed to work, but the first relationship i set up showed up on two childposts, which was not supposed to be.

what i did now to make it look like Avada is something like that:

<article class="fusion-post-medium post fusion-clearfix type-post status-publish format-standard has-post-thumbnail">
<div class="adjust-thumbnail fusion-flexslider flexslider fusion-post-slideshow">
<ul class="slides">
<li class="flex-active-slide" style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 1; display: block; transition: opacity 0.6s ease; z-index: 2;">
<div class="fusion-image-wrapper fusion-image-size-fixed" aria-haspopup="true">
<a href="[wpv-post-url]">
[wpv-post-featured-image size="medium" class="attachment-blog-medium size-blog-medium wp-post-image"]
</a>
</div>

</div>

<div class="fusion-post-content post-content">
<h2 class="entry-title fusion-post-title">[wpv-post-link]</h2>
</div>
<div class="fusion-post-content-container">[wpv-post-excerpt length="30" count="word" more=" - ..."]</div>
<div class="fusion-clearfix"></div>
<div class="fusion-meta-info">
<div class="fusion-alignleft">
<span class="updated rich-snippet-hidden">[wpv-post-date format="F j, Y g:i a" type="modified"]</span>
<span>[wpv-post-date]</span>
<span class="fusion-inline-sep">|</span>
[wpv-post-taxonomy type='category']
<span class="fusion-inline-sep">|</span>
<span class="fusion-comments">
<a href="hidden link">[wpv-post-comments-number]</a></span>
</div>
<div class="fusion-alignright">
<a href="[wpv-post-url]" class="fusion-read-more">
Read More </a>
</div>
</div>
</article>

does it make sense to do it like that? i just copied the whole avada containers and classes and filled it with types shortcodes and it makes it look exactly like it. if thats a way to go i would build up the post archives and the posts in a similar way.

The more i get to know toolset the more impressed i am by the possibilities it offers. and i am very grateful for the support.

#517749

Great that you could solve it.

Please open one ticket each other issue, as we handle one issue only per ticket:
https://toolset.com/toolset-support-policy/

As far I understand, the issue "post relationship between blogposts and cpt breaks the add blogpost function" is solved, right?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.