add_options_page();
for my options page. I’ve also looked in the source and there lies the function. The codex also has this function being used to add options pages for WP-2.7 and later. Yet wordpress is failing saying that the function does not exist? How the hell is this possible? Can anyone help me? Here’s my code for reference.
<?php
/*
Plugin Name: Sahfire Options
Plugin URI: https://demosite.com
Description: Options page for Sahfire WordPress Theme
Version: 1.0
Author: Bobby Ruby
Author URI: https://rubyfiredesigns.com
*/
function sahfire_theme_options(){ ?>
<h2>Hello</h2>
<?php }
add_action('admin_menu', sahfire_menu());
function sahfire_menu() {
add_options_page('Theme Options', 'Theme Options', 'administrator', __FILE__, sahfire_theme_options());
}
?>
]]>I followed wordpress instructon (https://codex.www.ads-software.com/Creating_Options_Pages#See_It_All_Together_2) and got it to working so that the options are saved into the database.
Now my other file in plugin folder is options.php
<?php
require_once ($_SERVER["DOCUMENT_ROOT"] . '/file2.php');
// *** Add your API Key, Secret Key here ***
$appapikey = '[<?php echo get_option('option_etc'); ?>]';
$appsecret = '[000000000000000000000000000000]';
$facebook = new Facebook($appapikey, $appsecret);
// $user_id = $facebook->require_login();
echo '<div id="iframeLinkDiv"><a clicktohide="iframeLinkDiv" onClick="outside_location.setInnerFBML(link_1);" style="cursor: pointer;"><img src="<?php echo get_option('new_option_name'); ?>" border="0" alt="" /></a></div>';
echo '<div id="outside_location"></div>';
echo '<fb:js-string var="link_1">';
echo '<iframe height="500px" allowTransparency="true" frameborder="0" scrolling="yes" style="width:520px; src="<?php echo get_option('some_other_option'); ?>">';
echo '</iframe>';
echo '</fb:js-string>';
echo '<script type="text/javascript" charset="utf-8">
var outside_location = document.getElementById("outside_location");
</script>';
?>
What am i doing wrong? Why can’t i get the inserted data directly inside the other php file?
It says:
Parse error: syntax error, unexpected T_STRING in /home/…/plugins/pluginname/options.php on line 5
Am i even in the right direction? I am running a multisite with subdomains and i can activate this plugin in network mode, but i want that the users can edit this file and the database will remember every users inserted data.
Thanks for reading
I’ve got three options: song name, mp3 URL, and ogg URL. WP saves the song name and the ogg url, but not the mp3 url.
https://christopherjoel.com/FantasyWorld/music/
Here’s the code page:
[Code moderated as per the Forum Rules. Please use the pastebin]
]]>They both create options pages, correct? Then why are they so vastly different from one another? Am I missing something?
]]>