I currently have a Wordpress plugin that allows me to input my YouTube Channel ID in wordpress admin.
I also have a JavaScript YouTube script running which I would like to insert the channel ID value to replace "YoutubeChannelId" in my JavaScript file.
Below is the JavaScript code that I need to fix to display the same ChannelID that is inputted into my wordpress admin.
Below that is the PHP code snippet to input and display the ChannelID input code.
Any ideas? (Thank you in advance)
function makeRequest() {
var request = gapi.client.youtube.search.list({
part: 'snippet',
channelId: YoutubeChannelId,
playerVars: { 'autoplay': 1, 'controls': 1,'autohide':1, },
maxResults: 1,
type: 'video',
eventType: 'live'
// Channel ID
add_settings_field(
$this - > option_name.
'channel', // Setting Slug
__('YouTube Channel ID', 'wpsk'), // Title
array( & $this, 'settings_field_input_text'), // Callback
$this - > slug.
'_general', // Page Name
'ytc_general', // Section Name
array(
'field' => $this - > option_name.'[channel]',
'description' => sprintf("<strong>[%s]</strong> ".__('Your YouTube Channel ID (get it from <a href="%s" target="_blank">YouTube Account Overview</a>)',
'wpsk'), __('Required'), 'https://www.youtube.com/account_advanced'),
'class' => 'regular-text',
'value' => $this - > defaults['channel'],
) // args
);