PHP Code Widget
[resolved] secret to includes (2 posts)

  1. timemachines
    Posted 3 years ago #

    I have tested the PHP widget - and it works with the usual "Hello World" - however, I can never seem to get a simple include code to execute.
    \<?php include 'pagetitles.php'; ?>\



  2. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 3 years ago #

    That include isn't specific as to the location of 'pagetitles.php'. When you're running in the widget context, you don't know the relative location of where the executing file is. So use the ABSPATH constant to specify the location of your file relative to the WP Root directory.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic