WordPress.org

Ready to get started?Download WordPress

Forums

Adamos
404 Errors When Using Child Theme (8 posts)

  1. Dominic
    Member
    Posted 3 months ago #

    First, thanks for a great theme. I'm making some small modifications with a child theme and I'm seeing some 404 errors for the following files:

    http://example.com/wp-content/themes/adamos-child/js/flexslider.css?ver=3.9"
    http://example.com/wp-content/themes/adamos-child/js/flexslider-init.js?ver=3.9"
    http://example.com/wp-content/themes/adamos-child/js/jquery.flexslider-min.js?ver=3.9"
    http://example.com/wp-content/themes/adamos-child/js/flexslider-init.js?ver=3.9"

    This problem seems to stem from referencing these resources with get_stylesheet_directory_uri() instead of get_template_directory_uri() in the theme's functions.php file. Given that these are mostly libraries that shouldn't be overridden by child themes, it seems like get_template_directory_uri() would be a better choice. Thanks.

    See the codex here: https://codex.wordpress.org/Function_Reference/get_template_directory_uri

  2. salsaturation
    Member
    Posted 3 months ago #

    You are right and hopefully the theme author will correct that issue on the next version. Unfortunately it should have been picked up during the theme review process but wasn't. Most likely the theme author will see this ticket but I have added a comment in the them trac as well just in case

  3. esmi
    Forum Moderator
    Posted 3 months ago #

    I'd argue that this isn't a bug but a deliberate design decision. By using get_stylesheet_directory_uri(). the theme's developers of offering the greatest possible child theme flexibility - including an option for people to use custom .js scripts. All you need to do initially is place a copy of the js folder in your child theme.,

  4. salsaturation
    Member
    Posted 3 months ago #

    Hi Esmi sorry to differ on this but this is a requirement as far as I know nothing has changed. Here is an example reviere from Chip

    Required
    When referencing (such as for enqueueing) resources (e.g. scripts, stylesheets, etc.), use get_template_directory()/get_template_directory_uri() instead of get_stylesheet_directory()/get_stylesheet_directory_uri(). The latter will break in a Child Theme.

    https://themes.trac.wordpress.org/ticket/17607#comment:10

  5. salsaturation
    Member
    Posted 3 months ago #

    Here is the relevant guideline

    Themes are required to include functional and resource files in a manner that facilitates the use of Child Themes:
    - Use get_template_directory_uri() to include functional files, or resources that are not intended to be included in/over-ridden the Child Theme.
    - Use get_stylesheet_directory_uri() to include resources that are intended to be included in/over-ridden by the Child Theme.

    http://make.wordpress.org/themes/guidelines/guidelines-template-tags-and-hooks/

  6. esmi
    Forum Moderator
    Posted 3 months ago #

    Use get_template_directory_uri() to include functional files, or resources that are not intended to be included in/over-ridden the Child Theme.

    [Italics are mine]

    Seems to me that the moot point here is the intention of the theme developer. If this was a deliberate design decision, than it wouldn't be bug. Wouldn't be the first time Chip & I have disagreed. :-)

  7. salsaturation
    Member
    Posted 3 months ago #

    :-) Fair enough and not necessarily a bug but if the child theme breaks at it's most basic then that is wrong after all we always advice users to create child themes. A user should just create a basic child theme rather than have to fix such issues

    If the user then wants to include their own script libraries they can always dequeue the parent them files and enqueue their one version... just my 2c's

  8. Ossie Heffell
    Member
    Theme Author

    Posted 3 months ago #

    OK thanks guys - I will change this for the update

Reply

You must log in to post.

About this Theme

About this Topic