1

I asked this question elsewhere, and was told with the following code, that I was using my defines incorrectly? So nothing is getting returned currently -

I have tried setting constants in functions.php -

define( 'THEME_DIR', get_template_directory() . '/' );
define( 'THEME_URI', get_template_directory_uri() . '/' );

and then in my config file -

$sample_patterns_path = 'THEME_DIR' . '../sample/patterns/';
$sample_patterns_url = 'THEME_URI' . '../sample/patterns/';
  • 3
    when you *use* a constant, you don't put quotes around it. ie THEME_URI, not "THEME_URI". if you use quotes, php thinks it's a string. – frymaster Jul 27 '15 at 22:05
  • possible duplicate of [PHP - assign value of function to class constant](http://stackoverflow.com/questions/5526365/php-assign-value-of-function-to-class-constant) – Dr.Molle Jul 27 '15 at 22:10
  • Do not define constants, stay out of global scope, it is evil. With easy to recreate names like that, you **will** run into issues. Never create constants or globals, period :-) – Pieter Goosen Jul 28 '15 at 04:30

1 Answers1

1

Use this code, without slashes:

$sample_patterns_path = THEME_DIR . 'sample/patterns/';
$sample_patterns_url = THEME_URI . 'sample/patterns/';
Marko Šutija
  • 345
  • 3
  • 9