PHP Code Widget
[resolved] Any Limitations? (3 posts)

  1. dorich
    Posted 3 years ago #

    I can't get the widget to display the results of my php.

    Being a neophyte I developed the php on the template to demonstrate that it worked correctly then copied it to the widget space. However, while it works on the template/page the widget shows nothing.

    My php is doing the following:
    Reading the ID and term of the current post, then creating a new query to list other titles in the same term. In addition it highlights the title of the current post in the list.

    I've shown the plugin is working correctly by ehco'ing some text onto the page.

    Are there likely to be any limitations on the php code that will work inside the widget?



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

    Posted 3 years ago #

    The widget does not run code in the global scope. So any global variables that you're using must be explicitly declared as global.

  3. dorich
    Posted 3 years ago #

    That solved it.

    Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic