• I have the following code, but I need to add a line of code from the WP admin to this, but can’t figure out how to do that.

    I started off with this:

    <?php
    $app_id = "echo get_option('appid');";
    ?>

    Then I tried to add the line of code from admin using:

    $app_id = "echo get_option('appid');";

    A bit too literal maybe, so I removed the semi-colon within the quotes:

    $app_id = "echo get_option('appid')";

    I’m running out of hair to pull out, so if anybody can help, that would be great.

    Thanks.

Viewing 8 replies - 16 through 23 (of 23 total)
  • Fatal error: Call to undefined function get_option()

    I missed this. Re-upload a fresh copy of the core files (with the obvious exception of the wp-content folder)?

    Thread Starter HorrorUK

    (@horroruk)

    I’m just re-uploading those files.

    The options can be viewed on that URL. That’s a useful thing I didn’t know I could do – the great thing about WP.

    Thread Starter HorrorUK

    (@horroruk)

    The files have been uploaded, and the error is still there:

    Fatal error: Call to undefined function get_option() in /var/www/vhosts/writers-site.com/httpdocs/wp-content/plugins/facebook-tabs-for-wordpress/fbindex.php on line 6

    Line 6 is:

    $app_id = get_option('tabsappid');

    Oh – this is officially weird. Try as I might, I cannot replicate that error. And get_option() has been part of WP core since version 1.5! Try deleting all files & folders – except the wp-content folder plus your wp-config.php & root .htaccess file. Then re-upload everything – except wp-content -from a fresh download of WordPress.

    Thread Starter HorrorUK

    (@horroruk)

    Thanks, I’ll give that a go.

    Just to be clear about how this is set up. This is all in a folder within the plugins folder. There is the main index.php file which holds the plugin code at the top and the code for the admin page, then this file which is within the same folder.

    It should still work within a plugin.

    Thread Starter HorrorUK

    (@horroruk)

    Still the same problem.

    Am I supposed to do something with that page to say that it should be calling from wordpress?

    It could be something to do with the way in which you’re creating the plugin generally (although I have to say that I’ve never come across this kind of error in plugin development before). Have you reviewed Writing_a_Plugin and the [Settings_API]?

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘adding echo get_option correctly’ is closed to new replies.