I have a function inside my submit text area that will add bbcode, wrap it around text.
<script>jQuery(document).ready(function($){$('#user-submitted-title').on('keyup',function(e){ $('#user-submitted-content').val('[bbcode]'+ $(this).val() +'[bbcode]');});});</script><input id="user-submitted-title" name="user-submitted-title" type="text" value="" placeholder="<?php esc_attr_e('Post Title', 'usp'); ?>"<?php if (usp_check_required('usp_title')) echo $usp_required; ?> class="usp-input"><textarea id="user-submitted-content" name="user-submitted-content" rows="5" placeholder="<?php esc_attr_e('Post Content', 'usp'); ?>"<?php if (usp_check_required('usp_content')) echo $usp_required; ?> class="usp-textarea"></textarea>Now what I want to do is by that keyword...For example if in textarea I type MUSIC VIDEO.How can I use YouTube API to search and retrieve first relevant result into bbcode [bbcode]0M1FGE9W67g[/bbcode]
So I need a shortcode function for that...
function bbcode( $atts, $content = null ) {here comes that code which i need return '<iframe width="560" height="315" src="'.$some_function.'" frameborder="0" allowfullscreen></iframe>';}add_shortcode( 'bbcode', 'bbcode' );Now, question is is this possible to do it within submit button, when I press submit button, it will auto search by #user-submitted-title and add ID auto in bbcode, because on every new watch of the video it won't use api balance limit quota if I do it before submitting (where to use that function, like on submit to search and add ID into BBCODE), cause ID of the video would be there in the iframe.
If the first version is not possible how do I make it to stay like[bbcode]keyword[/bbcode]
and use some function to search and iframe embed video every single time the function runs aka page is open?
Hope you guys understand, my English is not that good, but I explained my best what I want to do.