Support » Plugin: PHP Code Widget » [Plugin: PHP Code Widget] Using and displaying data from the custom fields

  • Resolved ucarmetin

    (@ucarmetin)


    Hello!

    I’m using the plugin and must admit it has saved me a lot of time and effort. It works like charm.

    However, I got a problem. I have a custom field where a sub title can be attached to the posts. I want this custom field to be displayed on the sidebar via the plugin. I wrote the appropriate code but it doesn’t display the value of this custom field. Here you can see my code. What am I doing wrong?

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Samuel Wood (Otto)

    (@otto42)

    Code in the widget runs in a function call, and so you have to declare that you want access to global variables.

    Try adding <?php global $post; ?> to the top of your code.

    Hej Otto,

    Thanks for the help. The issue is resolved.

    Regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: PHP Code Widget] Using and displaying data from the custom fields’ is closed to new replies.