WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. dorich
    Member
    Posted 1 year 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?

    Thanks.

    http://wordpress.org/extend/plugins/php-code-widget/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year ago #

    That solved it.

    Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags