Can you "dynamically" create shortcodes?

I have created a little php code that I plan to place in a “Custom HTML” widget. In short, they select a subject matter in the first drop down menu which then populates the second dropdown. This contains TWO types of data. The first is a userID (YouTube) so that it can access their channel. The other (used once) is a search term, such as
12312312312
23434556786
34534534534
Amazon
(The first three are channel ID.s the latter a search term)

Having (briefly) read through the docs, I see that everything is based on shortcodes on a page. I’m wondering if I can “submit” this form to someplace, (such as a query string, maybe adding extra Tubepresss fields) that the page containing the shortcode will be able to interpret.

** I THINK it might be possible with a variant of the search box, ie me supplying the data rather than the user inputting, but whilst I’m OK with Ajax and sending that via Javascript, I’m not too sure what webhook I’d use to send the data to theTubePress plugin - if even possible

I should add I’m only “experimenting” with the trial at present, but the “Pro” looks a definate poss. From the demos, I like the fact that the videos are in a lightbox - rather that starting in the “prepend” area and scrolling the page into view. It also seems more ‘versatile’ in terms of what can be amended … although “child themes” and templates is a new ‘ball game’

Thanks in advance

NB: Forgot to add: The user channel loads specific “new” videos whilst the keyword is any ‘random’ videos containing that tag.

Oh: I note too that it says data is stored locally in cache to avoid overloading the quota. Does that mean it stores meta data / thumbnail etc which is displayed on the page … or is it also caching the ENTIRE video that is played?

UPDATE:
Having read the docs again, I’m wondering if something along these lines would work. At this stage, the bold parts are wrong code wise, but just to give a sort idea what I am proposing.

If they have selected a user:
[tubepress output=“searchResults” searchProvider=“youtube” searchResultsOnly=“true” PHP HEADER searchResultsRestrictedToUser=%javascript entry??%"]

If they have a search term:
[tubepress output=“searchResults” searchProvider=“youtube” searchResultsOnly=“true” PHP HEADER keyword??=%javascript entry??%"]

ANy more insights?

I did wonder about creating my own shortcode on the page, that would then use a function to create the string … but no idea how to pass to TubePress. That said, “TubePressPro::getHTML ()” if I knew how and where to implement it

Hi @cristofayre, I’m so sorry for the delay in response! Our developer, who normally handles these types of questions, is on leave. I will be sure to follow up when he has a chance to review your questions. If there is anything else we can do in the meantime, please let me know!

Hello again, @cristofayre. Here is the response from our developer:

I see that everything is based on shortcodes on a page

In TubePress Pro for WordPress, that’s generally correct. You can type in a shortcode to let TubePress parse it, or you can invoke TubePress from a template (with input that very much resembles a shortcode).

I’m wondering if I can “submit” this form to someplace, (such as a query string, maybe adding extra Tubepresss fields) that the page containing the shortcode will be able to interpret.

Definitely! I would suggest that you use the WordPress template example as a starting point. Let’s say that the search term (or whatever is sent via the form submission) is stored in a variable “$search”. You could do something like this in your widget:

include WP_PLUGIN_DIR . '/tubepress_pro_x_y_z/src/TubePressPro.php'; print TubePressPro::getHTML('mode="search" searchValue="' . $search . '"');

Of course, you’d want to sanitize the input and/or otherwise interpret it however you see fit. Then use this input to formulate any name-option pair that you feed, as a string to TubePressPro::getHTML(). Does that make sense?

although “child themes” and templates is a new ‘ball game’

Thanks! We spent of a lot of time designing hierarchical themes and think the result turned out really well.

I note too that it says data is stored locally in cache to avoid overloading the quota. Does that mean it stores meta data / thumbnail etc which is displayed on the page … or is it also caching the ENTIRE video that is played?

Just the video’s metadata, which is almost entirely just text and doesn’t take up a huge amount of disk space. We do NOT cache the actual media (thumbnails, video, etc.).

Again, our apologies for the delay in getting a response to you! Hopefully this will provide a decent starting point? Hoping that you can make good use of TubePress, and please let us know if there is anything else we can do to assist.