Skip Navigation

[Resolved] Auto-select by default horizontal view for Multiple field backoffice

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 6 months ago.

Assisted by: Minesh.

Author
Posts
#2700276
Capture d’écran 2024-05-31 à 09.51.09.png

Hi,

Is there a way to select by default the horizontal display of custom multiples fields in the back office ?

Sincerely,

Quentin

#2700282

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no master setting available to change how Repeating Field Groups are displayed. I think it should be added and for that I suggest you should raise your voice by filing a new feature request using the following link:
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

However - I think I am able to find a workaround that will help you to resolve your issue.

Can you please try to add the following filter code to your theme's functions.php file:

add_filter('admin_url','func_display_rfg_horizontal_by_default');
function func_display_rfg_horizontal_by_default( $link ) {
    global $post_type;
   
  //// replace your post type slug
  $list_of_post_types = array('student','post','page');

    if(in_array( $post_type, $list_of_post_types )) {
        $params['rgview'] = 'horizontal';
        $link = add_query_arg( $params, $link );
}
    return $link;

}
#2700286

Hello Minesh,

Thank you for your quick feedback.

I'm not sure if your function works...
When I added a new page, or a new article, by default the field was always in vertical mode.
On the other hand, once I've clicked on the horizontal display button (burger) for this new article, if I ask again for the creation of a new article, it opens in horizontal mode, but this may be due to the fact that I had just specified this horizontal view.

To sum up, I don't think the function manages to systematically apply the default Horizontal view mode to the consultation/creation of a new page.

Quentin

#2700297

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - As shared there is no such option available but I shared workaround.

Here is a sandbox site and you can auto-login to it using the following link:
- hidden link

I've added the same code I shared to you on "Custom Code" section:
- hidden link

When I add/edit the gym post type post:
- hidden link

I can see the URL param is added rgview=horizontal:
- wp-admin/post-new.php?post_type=gym&rgview=horizontal

have you modified the code and adjusted the post type slug with the variable:

 //// replace your post type slug
  $list_of_post_types = array('student','post','page');
#2700328

It's work, thanks