Skip Navigation

[Résolu] After Layouts-update child-wrapping (ddl_render_row_start) not working anymore

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.

This topic contains 6 réponses, has 2 voix.

Last updated by dianaM-4 Il y a 4 années et 6 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#508471

I am trying to update all of my Toolset-plugins, but the Layouts-update breaks my layout. I found out, that it's because my filter, which is wrapping my child-layouts in a content-div, doesn't work anymore. So I guess, this hook changed in the new version?

Here is my code:

// Adding a content-div around child-layouts, before #leading and #footer
add_filter('ddl_render_row_start', 'wrap_child_layout', 999, 2);
function wrap_child_layout( $row, $args) {
    if( isset($args['cssId']) && $args['cssId'] == 'footer' ){
        $row = '</div>' . $row;
    } else if( isset($args['cssId']) && $args['cssId'] == 'leading'){
        $row =  '<div id="content">' . $row;
    }
    return $row;
} 

Everything worked till the update. Now my #content-div disappeared ...
Please for help!

#508788

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Dear Diana,

The filter hook "ddl_render_row_start" locates in Layouts plugin file \layouts\classes\wpddl.layout-render.class.php, line 252:

        $this->output .= apply_filters( 'ddl_render_row_start', ob_get_clean(), $args, $row, $this );

I just compared the lated version of Layouts plugin 1.9.3 with version 1.9.1, the above codes are same, nothing changed, since the problem you mentioned above is a custom codes problem, please check these first:
1) deactivate other plugins and switch to wordpress default theme, and test again
2) Enable PHP debug mode, copy and paste the debug logs here
PHP Debugging
In case you think that Types or Views are doing something wrong (what we call a bug), you should enable PHP error logging. Again, edit your wp-config.php file and add the following:

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . 'https://cdn.toolset.com/error_log.txt');
This will produce a file called ‘error_log.txt’ in your WordPress root directory. Make sure that the web server can create and write this file. If it cannot, use an FTP program to create the file and make it writable to Apache (normally, user www-data).
https://toolset.com/documentation/user-guides/debugging-types-and-views/

If the problem still exists, please provide a database dump file in below private detail box, I need to duplicate same problem and debug it in my localhost, thanks

#508867

I'm sorry, I made a mistake when uploading my database. If you really need it, please provide me a new private message box. But I'm not sure, what you are able to test with only the database and without my template, especially without functions.php? I could also provide you an UpdraftPlus-backup of my whole site if you need ...

Here what I found out in the meanwhile:
With only Toolsets plugins activated – still no surrounding content-div.
Switched to Toolsets Starter Theme and added the above code – still no change.
And no errors in my error-log.

So the hook doesn't work and the error is in its code, isn't it?
Isn't it important, in which order $row and $args are called in the hook?
And does the argument "cssId" still exist or is there a new name for it?

#509171

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Please test your custom codes in a wordpress installation with original Toolset Starter theme, but without other plugins.

If the problem still exists, please provide a database dump file in below private detail box, I need to duplicate same problem and debug the codes in my localhost, thanks

#509234

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the details, I am downloading the file, will feedback if there is anything found

#509247

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Please try to modify your PHP codes as below, and test again:

add_filter('ddl_render_row_start', 'wrap_child_layout', 999, 4);
function wrap_child_layout( $out, $args, $row, $renderer) {
    if( isset($args['cssId']) && $args['cssId'] == 'id="footer"' ){
        $out = '</div>' . $out;
    } else if( isset($args['cssId']) && $args['cssId'] == 'id="leading"'){
        $out =  '<div id="content">' . $out;
    }
    return $out;
} 
#509689

Thanks, Luo!
The new code is now working again!
Best regards, Diana