• Resolved graftedin

    (@graftedin)


    This is for anyone else that is having this error.

    =============
    Warning: Missing argument 2 for WC_Template_Loader::unsupported_theme_title_filter() in /home2/my_site/public_html/wp-content/plugins/woocommerce/includes/class-wc-template-loader.php on line 399
    =============

    Find line 399 in class-wc-template-loader.php and replace with this….
    public static function unsupported_theme_title_filter( $title, $id = false )

    Woo!!!!!!!!!!!!!! Please find a permanent fix for this!!!!!!!!!!!!!!!!!!

Viewing 12 replies - 1 through 12 (of 12 total)
  • This is caused by a plugin that applies the the_title-filter without the second (required) argument.

    See https://codex.www.ads-software.com/Plugin_API/Filter_Reference/the_title

    You can find the faulty plugin with this grep command:

    grep "apply_filters[(].*\\bthe_title\\b[^,]*,[^,]*)" * -R --include=*.php

    Thread Starter graftedin

    (@graftedin)

    From…https://codex.www.ads-software.com/Plugin_API/Filter_Reference/the_title

    Note the addition of null as the default value for the $id variable. This is because some instances of the usage of this filter did not supply a post ID. This inconsistency was introduced in version 3.1, and fixed in version 3.3 (see ticket #16688). If you want to be compatible with these older versions, you need to supply the default value as above, or you will end up with a PHP warning stating that you are missing an argument. If you don’t need to support 3.1 or 3.2, it isn’t necessary to specify a default value for $id.

    Even the WordPress documentation suggests adding a default value for ID!!!!!!!!!!!!!!!! I guess Woo doesn’t give a rip if it breaks sites that aren’t fully updated. And don’t preach to me about the need to keep sites updated…..I get it. In a perfect world we’d all be up-to-date. But in the real world not all sites can be updated as frequently. That means good development needs to make a reasonable effort to be backward compatible. Adding ” = false” is so SIMPLE!!!!!!!!!!!!!!! And would keep us from wasting hours and hours of time trying fix problems rather than focus on keeping sites up-to-date. If I had finished this project with budget left over I could have said “hey, I’ve got some time left would you like me to update the rest of your plugins while I’m in here?”

    I quoted 5 hours to install Woo and convert a bunch of products to Woo and that should have been plenty. I’m going to have to double future Woo quotes so that I have enough time to fix Woo’s “errors”. That means it will cost the client more to have Woo installed and less to have other solutions like Easy Digital Downloads installed….. By the way we had a working solution with Easy Digital Downloads that was a hodge podge of plugins. I argued for switching to Woo because it would simplify the solution. NOW I have had to update Woo’s core and the theme (because the original developer didn’t use a child) to get around Woo’s “errors”.

    I realize Woo is free but they hope to make money from us buying plugins. If I can’t get Woo to work for this project they will have lost $100+ from this project because they were too lazy to do ” = false”.

    Even the WordPress documentation suggests adding a default value for ID!!!!!!!!!!!!!!!!

    The documentation suggests it for WordPress 3.2 compatibility. Are you running WP 3.2? ??

    You’re right; the = false is a good workaround. Maybe the Woo team will pick it up from this topic but I suggest you post an Issue or PR on github.

    Still; I suggest running the grep to find out which plugin is missing the required second argument. Because the problem is another plugin. Not WooCommerce.

    Thread Starter graftedin

    (@graftedin)

    We upgraded to the latest WordPress. I figured we were going to need to because I checked the specs. I have 5 plugins and none of them were listed in the specs.

    I haven’t made that many plugins but in my humble opinion it is not hard to make code backwards compatible. And its not hard to use unique names for functions and variables that don’t conflict with other plugins. But on the off chance something gets missed…..its really not hard to fix it when its first reported. This error has been known for a while and I have yet to see a post where anyone actually FIXED IT! I just did and hopefully Woo does too.

    What other plugins are installed?

    Thread Starter graftedin

    (@graftedin)

    It doesn’t matter. 4 are for Easy Digital Downloads that will likely go away. The 5th is probably the offender and I don’t want to try to figure out what its doing and an other way around it.

    This bug is minor compared to other problems I’m having. I’ll post solutions when I find them.

    Just name ‘m please. I’ll take a look.

    Thread Starter graftedin

    (@graftedin)

    Easy Digital Downloads
    Version 2.6.11 | By Easy Digital Downloads

    Easy Digital Downloads – Adding a custom field
    Version 1.0 | By IDK

    Easy Digital Downloads – Downloads As Services
    Version 1.0.4 | By Andrew Munro, Sumobi

    Insert PHP Code Snippet (Probably the offender)
    Version 1.2 | By xyzscripts.com

    WooCommerce
    Version 3.5.2 | By Automattic

    WP Menu Cart
    Version 2.5.8 | By Jeremiah Prummer, Ewout Fernhout

    Yeah, either a snippet of the “Insert PHP Code Snippet” or the theme is the offender.

    NOW I have had to update Woo’s core and the theme (because the original developer didn’t use a child) to get around Woo’s “errors”.

    It sounds like the previous developer didn’t really know what he was doing. Either way you can’t blame WooCommerce for this because what you’re getting has nothing to do with WooCommerce. What you saw in the documentation was a discrepancy in WP 3.1 and 3.2 (in 2011!!!!). Your customer’s site just has a faulty snippet somewhere that omits the 2nd argument of the the_title-filter.

    Best of luck with the migration.

    Thread Starter graftedin

    (@graftedin)

    Woo’s category pages don’t load right because the theme doesn’t have support for Woo. By default Woo should have all of the correct template pages in place that then get over ridden by Woo supported themes. Instead their approach is to basically leave workable versions of this out and rely completely on theme developers to develop these pages.

    I set certain categories to display subcategories and not products. All I get are products, no pagination. I add in minimal theme support…

    add_theme_support( ‘woocommerce’….

    …. and then get sub categories to list but the products don’t list in the sub categories. And the styles are all messed up.

    Oh….You’ll love this…. Minimal support makes the unsupported_theme_title_filter problem go away.

    Anyway….I post a new subject on this when I find a fix that someone can easily reproduce.

    By default Woo should have all of the correct template pages in place that then get over ridden by Woo supported themes.

    That’s exactly how WooCommerce works. To create a WC compatible theme, you don’t need to insert any WC template files at all! Any template override is 100% optional.

    See https://docs.woocommerce.com/document/template-structure/

    Take a look at the StoreFront theme for example: https://nl.www.ads-software.com/themes/storefront/ it doesn’t include any WooCommerce template pages, only customization by means of hooks.

    Thread Starter graftedin

    (@graftedin)

    It doesn’t work. We can blame the theme or the plugins. If I were Woo’s developers I would not be satisfied with how this works.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘unsupported_theme_title_filter’ is closed to new replies.