WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code Widget
[resolved] Using and displaying data from the custom fields (3 posts)

  1. ucarmetin
    Member
    Posted 3 years ago #

    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/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 3 years ago #

    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.

  3. ucarmetin
    Member
    Posted 3 years ago #

    Hej Otto,

    Thanks for the help. The issue is resolved.

    Regards!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic