• Resolved janeverts

    (@janeverts)


    Hi,

    Where can i change the directory so i can decide where my own pdf templates are stored and used. It now gives a directory which teh plugins think is my child theme. But this is not my vhild theme and this directory will be overwritten by an update.

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

    (@pomegranate)

    Hi Jane,
    The plugin checks for the templates in the following order:

    • Child theme
    • (Parent) theme
    • Plugin

    So if I understand you correctly, your problem will be fixed if you move the template from the parent theme to the main theme. Note that if you have templates with the same name in BOTH the child theme and parent theme, you may run into issues, so I recommend removing any doubles if they are still in the main theme (and also make sure that the custom template is not called ‘Simple’).

    Hope that helps!
    Ewout

    Thread Starter janeverts

    (@janeverts)

    Hi Ewout

    Not completely. Can i determine my own directory where i store the files for my custom template?
    e.g. /wp-content/uploads/myownpdftemplates instead of placing it in a theme directory.

    Regards

    Jan

    Plugin Contributor Ewout

    (@pomegranate)

    Yes, that’s possible too.

    
    // Custom location for PDF template folders
    add_filter( 'wpo_wcpdf_template_paths', 'wpo_wcpdf_template_paths' );
    function wpo_wcpdf_template_paths( $template_paths ) {
    	$template_paths['custom_template'] = '/wp-content/uploads/myownpdftemplates/';
    	return $template_paths;
    }
    

    The actual template would then be located in /wp-content/uploads/myownpdftemplates/YOURTEMPLATE/

    Ewout

    Thread Starter janeverts

    (@janeverts)

    Thank you Ewout,

    where do i apply these changes? in wpconfig.php? or somewhere else?

    Plugin Contributor Ewout

    (@pomegranate)

    Normally in your child theme’s functions.php ??
    But it can be anything that executes within WordPress, a custom plugin too. Or Code Snippets.
    How to use filters

    Thread Starter janeverts

    (@janeverts)

    I used code snippets, but the plugin doesn’t see the new directory, in the plugin it self it still refers to the childtheme directory..

    IS the code okay? If i put it in the themefunctions.php I get a 500 error.

    • This reply was modified 8 years, 4 months ago by janeverts.
    Plugin Contributor Ewout

    (@pomegranate)

    Hi Jan,
    You need to enter the FULL path, /wp-content/etc is probably not the root.
    I think ABSPATH . 'wp-content/uploads/myownpdftemplates/ could work, worth a try at least.
    If you add it to the theme functions you need to disable the snippet first, otherwise the server has two functions with the same name and halts.

    Ewout

    Thread Starter janeverts

    (@janeverts)

    i’m sorry but i don’t understand this. I’m not good in php.

    where do i do abspath?

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Jan,
    That would be:

    
    // Custom location for PDF template folders
    add_filter( 'wpo_wcpdf_template_paths', 'wpo_wcpdf_template_paths' );
    function wpo_wcpdf_template_paths( $template_paths ) {
    	$template_paths['custom_template'] = ABSPATH . '/wp-content/uploads/myownpdftemplates/';
    	return $template_paths;
    }
    
    Thread Starter janeverts

    (@janeverts)

    Sorry Ewout,

    I left this aside for a while.

    I used the plugin code snippet, but still if I use your last code it still won’t use the myown template option. In the choose template I still see only your default template.

    I’m out off guesses and trying.

    Do you have some more tips /advice?

    Thread Starter janeverts

    (@janeverts)

    I found it, you can close it , thnak you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘change directory for own pdf templates’ is closed to new replies.