Reputation: 41
I have a theme options panel in Wordpress I created. I am trying to pull an API key from the field. But I cannot echo PHP within PHP. How would I do this looking at code below. The top code is what it needs to be after I fill in feild in options panel. The bottom is code I need to work. Hope this makes sense.
<?php
require_once('class.php');
// grab an API Key from http://admin.mailchimp.com/account/api/
// grab an API Key from http://admin.mailchimp.com/account/api/
$api = new MCAPI('77777777777777777777777777777777');
?>
Below is what I am trying to do with code
<?php
require_once('class.php');
// grab an API Key from http://admin.mailchimp.com/account/api/
// grab an API Key from http://admin.mailchimp.com/account/api/
$api = new MCAPI('<?php $text_area = get_option ('Mail_Chimp_API'); echo $text_area;?>');
?>
Upvotes: 0
Views: 69
Reputation: 1962
It looks like you just need
<?php
require_once('class.php');
// grab an API Key from http://admin.mailchimp.com/account/api/
$api = new MCAPI(get_option ('Mail_Chimp_API'));
?>
You do not need to "echo" your data per se. I suggest learning a bit of PHP from either W3Schools or other online resource. It will make your life a lot easier.
Upvotes: 0
Reputation: 1375
require_once('class.php');
// grab an API Key from http://admin.mailchimp.com/account/api/
// grab an API Key from http://admin.mailchimp.com/account/api/
$text_area = get_option('Mail_Chimp_API');
$api = new MCAPI($text_area);
assign the variable before using it.
Upvotes: 1