• Resolved fortiernor

    (@fortiernor)


    Hi,
    I want to declare/define functions that are used in more than one snippet, in a separate file, as that seems to be the only way (DRY).
    As a wordpress newbie, I need to know:
    – in which directory should I put the php file?
    – what would the include statement look like?
    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    You could put the PHP file in the wp-content directory (like wp-content/common-snippet.php)

    And then include it in snippets like this:

    require_once WP_CONTENT_DIR . '/common-snippet.php';

    Thread Starter fortiernor

    (@fortiernor)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to include an separate php file’ is closed to new replies.