• Resolved kit kat

    (@kit-kat)


    After updating my template won’t load anymore although it’s on my child theme and loads for my custom post type. Tried moving it around within my child theme and it still wont work. On localhost.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Paul Ryan

    (@figureone)

    Thanks for the report, I’ll get a fix out soon. The previous version fixed a security vulnerability, and I think I was a little too strict on where templates could be loaded from. Thanks for your patience!

    Plugin Author Paul Ryan

    (@figureone)

    Can you provide me an example shortcode so I can see what your display="" attribute (the custom template) looks like?

    Thread Starter kit kat

    (@kit-kat)

    Sure thing:

    [insert page=’alert’ display=’template-alert.php’]

    which is located in my \themes\CHILD_THEME\template-alert.php

    Currently using X Theme and it’s provided child theme: https://theme.co/apex/child-themes

    Plugin Author Paul Ryan

    (@figureone)

    Hm, I’m having trouble reproducing this.

    Can you provide me with some more info about your environment:
    * Is the child theme your active theme?
    * Is the theme directory in the normal place, i.e., wordpress_root/wp-content/themes/?

    And if you’re comfortable inserting debug statements into the Insert Pages code, that would really help:
    * Find the two occurrences of this line: $template = locate_template( $attributes['display'] );
    * Insert the following below it:

    error_log($attributes['display']);
    error_log($template);
    error_log(realpath($template));

    * Refresh the page that’s not working, and then grab those 3 lines from your web server log and share them here.

    Thread Starter kit kat

    (@kit-kat)

    Sorry for the delay.

    Child theme is my active theme.
    Directories are on standard wordpress place:
    base\wp-content\themes\x (main theme)
    base\wp-content\themes\x-child (child theme)

    here’s the logs:

    [Sun Oct 08 19:10:36.650002 2017] [php7:notice] [pid 7396:tid 1900] [client ::1:55341] template-alert.php, referer: https://localhost/ui/shop/
    [Sun Oct 08 19:10:36.650002 2017] [php7:notice] [pid 7396:tid 1900] [client ::1:55341] P:\\p\\XAMPP\\htdocs\\ui/wp-content/themes/x-child/template-alert.php, referer: https://localhost/ui/shop/
    [Sun Oct 08 19:10:36.650502 2017] [php7:notice] [pid 7396:tid 1900] [client ::1:55341] P:\\p\\XAMPP\\htdocs\\ui\\wp-content\\themes\\x-child\\template-alert.php, referer: https://localhost/ui/shop/

    Where can the templates be loaded from? I have my insertPost templates in a folder called template-parts in my theme root folder. It shows up in the plugin when I insert a shortcode but it’s not rendering for some reason.

    Plugin Author Paul Ryan

    (@figureone)

    Templates anywhere in your active theme should work. We will just need to fix up the code to address some platform-specific issues.

    Details: The new code that addresses the security vulnerability tries to jail templates to the existing theme directory. It does this by comparing the path returned by locate_template() to the evaluated path PHP generates using realpath().
    https://github.com/uhm-coe/insert-pages/blob/master/insert-pages.php#L371-L375

    If these paths are the same, the template is allowed to load. @kit-kat’s details above (thanks!) shows that on Windows platforms, realpath() turns all directory separators into double-backslashes, while locate_template() leaves some of them as forward slashes. This will be fixed.

    Plugin Author Paul Ryan

    (@figureone)

    A fix has been released in version 3.2.6, please update and let me know if that solved the problem.
    https://github.com/uhm-coe/insert-pages/commit/080f190658face8859896782b086634baffd50f8

    Thread Starter kit kat

    (@kit-kat)

    Works perfectly now.
    thanks for looking into it!

    Plugin Author Paul Ryan

    (@figureone)

    Great!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Not loading template after update’ is closed to new replies.