• Resolved sam_nazarko

    (@sam_nazarko)


    Hi

    I’m using WordPress and WooCommerce with Git. WordPress is configured as a submodule and I have slightly different directories for wp-content.

    Since this migration, I’m unable to view a PDF invoice from the Order page. When I click the link, I receive the following error:

    Template not found! Check if the following file exists:
    wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/Simple/invoice.php

    The file does exist, but it exists under a different path:

    ./website2017/content/plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/Simple/invoice.php

    It seems that it doesn’t work as expected when using a custom WP_CONTENT_DIR in wp-config.php. Here’s my wp-config.php:

            define('WP_SITEURL', 'https://' . $_SERVER['SERVER_NAME'] . '/cms');
            define('WP_HOME',    'https://' . $_SERVER['SERVER_NAME'] . '');
            define('WP_CONTENT_DIR', dirname(__FILE__) . '/content');
            define('WP_CONTENT_URL', 'https://' . $_SERVER['SERVER_NAME'] . '/content');
            define('UPLOADS', '../uploads');

    Thanks in advance

    Sam

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi Sam,
    Not sure what’s going on here. The plugin doesn’t specifically use wp-content at all, it stores a path relative to ABSPATH. Here’s the process:

    • When opening the settings page, it scans the plugin folder + /templates/pdf/ and the theme+child theme folder for custom templates. It lists these in the dropdown, by default this will be just “Simple”.
    • When you save the settings, it stores the path relative to ABSPATH of that template
    • When you create the PDF, it reads the settings (relative template path) and prepends ABSPATH to it.

    The only thing I can think of would be that you have moved to another site which doesn’t use wp-content, in which case you will need to select the correct folder on the settings page, save the settings and you should be fine. If that’s not the case, I don’t have an explanation for why this is not working.

    Is this on Apache or IIS?

    Let me know if the above helps to solve this issue!

    Ewout

    Thread Starter sam_nazarko

    (@sam_nazarko)

    Hi Ewout,

    Thanks for the reply.

    I’m using Apache. I can confirm that saving settings for the plugin fixed the issue.

    Sam

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Bug with paths when using WP under Git’ is closed to new replies.