Support » Theme: Customizr » Cookie Law Info conflict

  • Resolved kupili

    (@kupili)


    Hello,

    I use Cookie Law Info plugin with your theme.

    The problem is that on whatever page I create and use short code [cookie_audit] to create table of cookies, I get new text at the end of page with content from the first cookie in the table. That page has an article with 2 entrys (should be only one).

    Link to my site

Viewing 6 replies - 1 through 6 (of 6 total)
  • Maybe because of language, but I don’t see a double-entry. Can you describe where that is happening?

    I use CLI without a problem (though may not use in same way).

    Thread Starter kupili

    (@kupili)

    Posting link to screenshot for clarity.

    Found it. Can you switch to a different Theme and try it again, to prove it is a Czr issue. Post another screenshot. Thanks

    Thread Starter kupili

    (@kupili)

    Hi,

    Here is link to screenshot of default theme Twenty Fifteen.

    Hello,
    I looked into this.
    It’s not strictly a theme’s issue, it’s about some standard wp code the plugin misses which “hits” a sensible aspect of the theme.
    This theme doesn’t rely on standard wordpress templates, but uses wp functions to determine which kind of content is about to display, whether it’s a post, a page, a category (post list in general) and so on.
    It might happen that the theme, sometimes for its fault, sometimes not, “thinks” it has to display a page and also a post (as in this case).
    Though this time, I can say that it’s plugins fault.
    When the plugin parses its table shortcode creates a new WP_Query, instantiate the post, but then forgot to reset it once its work has been done.
    That’s their code:
    http://plugins.svn.wordpress.org/cookie-law-info/tags/1.5.3/php/shortcodes.php

    look at the function function cookielawinfo_table_shortcode

    That’s the CODEX page about WP_Query:
    https://codex.wordpress.org/Class_Reference/WP_Query
    (see wp_reset_postdata() after the custom loop)

    So if you put (as it should)
    wp_reset_postdata

    here:

    endwhile;
    	$ret .= '</tbody></table>';
    	return $ret;
    }

    before return $ret, so that it looks like:

    endwhile;
    	$ret .= '</tbody></table>';
            wp_reset_postdata();
    	return $ret;
    }

    You should not see the double content (I tried it here, and it works fine once I add that).
    Maybe you want to report the issue to the plugin’s developer, ’cause as you can read CODEX it misses a required step:

    Note: If you use the_post() with your query, you need to run wp_reset_postdata() afterwards to have Template Tags use the main query’s current post again.

    Hope this helps.

    Thread Starter kupili

    (@kupili)

    Thanks!
    It works perfectly.

    I will notify developers of plugin to squash that bug.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Cookie Law Info conflict’ is closed to new replies.