Disqus conditional load doesn't work in Preview mode

Posted in: Newspaper
Post count: 14

Hey everyone, when trying to preview a post with Disqus Conditional Load plugin activated, I get this error:

[29-May-2019 14:58:59 UTC] PHP Warning: require(/var/www/html/wp-content/plugins/td-composer/legacy/Newspaper): failed to open stream: Success in /var/www/html/wp-includes/comment-template.php on line 1510
[29-May-2019 14:58:59 UTC] PHP Fatal error: require(): Failed opening required ‘/var/www/html/wp-content/plugins/td-composer/legacy/Newspaper/’ (include_path=’.:/usr/share/php’) in /var/www/html/wp-includes/comment-template.php on line 1510

What’s the fastest way to fix this?

Post count: 14

Bump

Post count: 35449

Hi,

Unfortunately we did not tested Disqus Conditional Load plugin and therefore, we cannot say for sure if it will work or not as expected with the theme, sorry! Also, we cannot provide support for untested plugins.
This is our list with tested plugins with our theme -> https://www.screencast.com/t/cmPkh9jba4sZ

Thank you!

Post count: 14

Hi @Calin,

I completely understand, but could you at least point me to a potential problem? Directory ownership problem or something along those lines?

Post count: 35449

Hi,

You can check this topic about disqus -> https://forum.tagdiv.com/topic/comments-counter-with-disqus/

Thank you!

Post count: 230

Got a fix for this. Go to wp-includes/comment-template.php, and then to the function comments_template.

Under the first if function, insert this:

if ( is_preview() ) {
return;
}

Should look like this:

function comments_template( $file = '/comments.php', $separate_comments = false ) {
global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;

if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) {
return;
}

if ( is_preview() ) {
return;
}

Basically stops the function from running if it’s a post preview. Fixes it nicely.

Hope this helped! Be sure to update it every time there is a WP update 😀

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.