Skip Navigation

[Escalated to 2nd Tier] Post references options not showing

This support ticket is created 4 years, 8 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 4 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#1321991

Hi Toolset,

I'm building a post form with post reference fields. But the options only show up in the default language of the site? Any idea how to solve this?

Thanks,
Menno

#1322009
#1322917

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Menno,

Thank you for waiting, while I performed some testing and research.

I can confirm that this is a known limitation, that to join two posts in a relationship, the primary language versions need to exist between them.
( this also applies to posts in post reference fields, since they also rely on post-relationship )

From your comments on the other tickets, I understand that your users will be creating posts in their own languages, which won't always be the same as the primary language.

To overcome this limitation, there are a few workarounds that you can use:

1. You can make sure that when a new post is created using a Toolset Form, a duplicate entry for it is also programmatically created, in the primary language. Toolset Forms API offers "cred_submit_complete" hook, which can be used to attach a custom function to a form submission:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_submit_complete

You can also consult, WPML plugin's official support on how a translated/duplicated post in a different language can be created.

OR

2. Instead of using post-relationships or post reference field to connect two posts, you can use a regular "select" type custom field, that shows a list of available posts and then stores the ID of the selected post's ID in the custom field.

The "wpt_field_options" filter can be used to dynamically insert the options in a select type field:

Example:


add_filter( 'wpt_field_options', 'func_to_dynamically_populate_select_options', 10, 3);
function func_to_dynamically_populate_select_options( $options, $title, $type ){
    switch( $title ){
        case 'Field Title':
            $options = array();
            // add or generate the array of your desired option titles and values
            $options[] = array('#value' => '', '#title' => '---',);
            break;
    }
    return $options;
}

I hope this helps and please let me know if you need any further assistance around any of these workarounds.

regards,
Waqar

#1324133

Hi Waqar,

Thanks for your support and workarounds :). I like your ideas but we don't want to use too much workarounds and use standard usage of the plugins. If we choose option 1, the posts are still not selectable in post forms on secondary languages. With option 2 the select list becomes verrryy long for some users.

I think the post relationship function of the plugin is very powerful but some key features are missing now, like the the usage of non-standard languages but also the option to add more post filters than just one. I would be very happy if these features are added in the next releases :).

Thanks,
Menno

#1324387

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Menno,

Thanks for writing back and for sharing this feedback.

We're committed to further improve Toolset, based on the suggestions and feedback we receive. I'll suggest adding your voice for this feature too, through our feature request form:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

I'm afraid, I don't have a time estimate to share at the moment, but will be happy to update you through this ticket, once a builtin support is included for this.

You're welcome to open a new ticket for each new question or concern.

regards,
Waqar