Skip Navigation

[Resolved] Parent dropdown not working in custom theme

This support ticket is created 6 years, 2 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 7 replies, has 2 voices.

Last updated by MattI4840 6 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1132990
TwentySeventeen.JPG
CustomTheme.JPG

I am trying to:

I'm creating a custom theme using wprig, and some of the cred forms I've created have drop downs for you to select parent posts. When I use the TwentySeventeen theme they work as expected, when I switch to my custom theme the drop downs only populate the '--- not set ---' option, and none of the parent posts.

Link to a page where the issue can be seen:

I will have to give you the login for the site.

I expected to see:

A drop down populated with parent post options

Instead, I got:

A blank list

Further info:

I compared he js files that were being loaded by twentyseventeen and made sure they were all being loaded in the custom theme as well. This had no effect on the drop downs, so I'm wondering what else could be causing the issue.

#1133195

Hi Matt,

Thank you for contacting us and I'll be happy to assist.

The fields to select the parent posts, make use of a special script library ( Select2 - hidden link ).

If that script is not working only when the custom theme is active, it suggests that there is some script loaded only by that theme, which is resulting in the conflict.

When I checked your website, it had "Twenty Seventeen" theme active and the post select fields were working as expected (just as you mentioned).

Since I didn't have your permission to switch theme, I couldn't see the issue, but for further troubleshooting, I'll suggest the following steps:

1. Please update all plugins to their most recent versions

2. Next, activate the custom theme and then check the browser's console for any errors/warnings, when the page with the form is being viewed.
( ref: https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors )

3. If the issue still persists, please keep the custom theme active and make a complete backup of your database and website and let me know once done.

I would additionally need your permission to deactivate and reactivate Plugins and the Theme and to change configurations on the site. This is also a reason the backup is really important.

Let me know how it goes and if you have any further information.

regards,
Waqar

#1133652
js_errors.JPG

Waqar,

Thank you for getting back to me, I have followed the debugging steps you sent over and I'm getting several errors in the console, see attached image. None are from the select2.js file, but I am seeing several in relation to select2_frontend.js and two in relation to frontend.js. Please take a look and let me know what you think the issue may be. You have my permission to do whatever you need to on the site to figure this issue out. I've backed up the db and the site files.

Thanks,
Matt

#1134322

Hi Matt,

Thanks for writing back and for your permission.

I noticed that your custom theme "Darby Tracking" is loading several script files through its "functions.php" file, which are originally loaded by the Toolset forms plugin.

As a result of this duplicate loading, some of them (e.g. "underscore.min.js") are not loading at all or are loading in the incorrect order.

I'll suggest to check your theme's "functions.php" file and remove all those enqueued scripts, which are not needed by your theme.

Any scripts which will be required by the Toolset plugins will be loaded automatically.

I hope this helps.

regards,
Waqar

#1134329

Waqar,

I can do that, but this issue was present before I added those scripts to the functions file. In fact I added them specifically to fix this issue as they didn't appear to be loading correctly from just the plugins. Let me know your thoughts.

Matt

#1134612

Waqar,

I've done as you requested and commented out all of the scripts coming from toolset plugins. Unfortunately the problem persists, can you take a look and let me know how to proceed with troubleshooting.

Thanks,
Matt

#1135019

Hi Matt,

I noticed that even after you've commented out those scripts, the actual scripts from Toolset plugins were not being loaded with your custom theme.

But then I checked the theme's "footer.php" file and noticed that the "wp_footer" template tag was also commented out:
( screenshot: hidden link )


<?php //wp_footer(); ?>

This template tag is very important and Toolset and other plugins use it to hook necessary scripts.
( ref: https://codex.wordpress.org/Function_Reference/wp_footer )

Please uncomment it and then check the form again.

regards,
Waqar

#1136290

I removed the rest of the scripts that were enqueued and removed the footer comment and all is working as expected now!