Skip Navigation

[Resolved] Content Templates Not Loading – Throwing js error

This thread is resolved. Here is a description of the problem and solution.

Problem:
The error below was being displayed when displaying a Content Template:

Uncaught TypeError: Cannot read property 'singular' of undefined

Solution:
Issue addressed on Views 2.0.

This support ticket is created 8 years, 3 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
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

Tagged: 

This topic contains 10 replies, has 3 voices.

Last updated by ngo6012 8 years, 2 months ago.

Assisted by: Adriano.

Author
Posts
#364455
screenshot-error-content-template.png

I'm getting a blank page when I try to load some content templates. There is a javascript error being thrown:

Uncaught TypeError: Cannot read property 'singular' of undefined

The error is on line 907 of the file wp-views/res/js/ct-editor.js:

labelSingular: ct_data.usage_post_type_labels[key].singular,

I've disabled all plugins, switched back to the default theme and at first, it was working when I was on the default wordpress theme, but now I cannot access some content templates at all, regardless of being on the default theme with only WP-Views and WP-Types activated (and all other plugins deactivated).

Thank you very much in advance for your assistance!

#364513

Thank you for contacting Toolset support, I'd be delighted to assist!

Could you please enable debug in the wp-config.php file and reload the page to display any PHP errors and paste it here? It would greatly help troubleshoot the issue. Thanks!

#364528

There aren't any PHP errors displaying for that page - debug was enabled when I took that screenshot. Thanks!

#364839

I appreciate your feedback!

To best troubleshoot the issue and to send to our developers, please make a snapshot of your site using the Duplicator plugin: https://wordpress.org/plugins/duplicator/. Once the snapshot is complete, either upload the snapshot ZIP file and the installer.php file to a file sharing service such as Dropbox (and share the link in your reply) or right click the Duplicator links in your wp-admin and paste in your reply.

I will enable the next reply to be private so only you and I have access to it!

#365050

Howdy! I was trying to download the snapshot files from your server and I'm getting a error 500 (permission denied).

Could you kindly upload the duplicator file and installer.php to a filesharing site such as Dropbox? Thank you!

#365497

Thank you for checking the links for me, they all work now!

I couldn't figure this one out, I'm going to send this over to our 2nd tier supporters and developers for troubleshooting!

#365782

Thanks Ross, I appreciate your effort. I look forward to connecting with 2nd tier support!

#365911

Hello,

We've found an argument that isn't being validated by Views in certain case. We've forwarded this to our development team. Meanwhile you can use the workaround below:

add_filter( 'wpv_ct_editor_add_custom_properties', 'journal_theme_fix_corrupted_dissident_post',50,2 );
function journal_theme_fix_corrupted_dissident_post($ct_data, $ct) {    
    
    if (isset($ct_data['dissident_posts'])) {            
        if (is_array($ct_data['dissident_posts'])) {
            foreach ($ct_data['dissident_posts'] as $k=>$v) {
                if (empty($k)) {
                    unset($ct_data['dissident_posts'][null]);
                }                
            }
        }
    }
    return $ct_data;
}

Please let me know if you are satisfied with my reply and any other questions you may have.

Regards,

Adriano Ferreira

#366077

Thank you so much! That seems to have worked - if there is a more permanent solution I should implement in the future, please do let me know. Thank you again!!

#366175

You are welcome.

#368298
Screenshot 2016-02-18 23.12.45.png

Hello! I'm not sure if I should start a new thread - happy to do so, but I think I have another related issue. I'm now returning to the website for the first time since applying the fix and I'm having trouble with the following:

- Saving an existing view after making changes to any part of the view;
- Creating a new view and saving it (after clicking "Finish" in the loop wizard box, it freezes with the saving spinner perpetually spinning);

I've attached a screenshot of the js error that is being thrown.

Thank you very much in advance for your assistance!

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