Shortcode in Featured Video

Posted in: Newspaper
Post count: 19

Amazing theme – by far very flexible and very helpful support!!

I would like to place a video into the appropriate location using Style 11; however, it is not a link to youtube, vimeo, or dailymotion. I have a shortcode for the video I would like to use. Is there a way to place my video shortcode in the same location as Style 11?

Thanks,
Ajay

Post count: 6535

Hi

You can try to use the do_shortcode function in single_template_11.php file like here: http://screencast.com/t/vgE0eaqNM9 but i am not sure that the video will be displayed because the theme have video support only for youtube, vimeo and dailymotion.

Thanks!

Post count: 19

Sorry Andrei – took a break for the holidays ! hope you had a great holiday and are excited/enjoying the new year!!

As for the response – are you sure it wouldn’t be an update to td_video_support.php under the wp_booster folder? I see here the case scenarios for youtube, vimeo, and dailymotion. Could I add in a do_shortcode here and get the ID for the shortcode since that is a required parameter? (i.e. [videoadplayer id= “770”]) and thus all I will have to do is put 770 into the “featured video” box on creating the post.

Let me know your thoughts! Thanks for the great support 🙂

-Ajay

Post count: 19
    /*
     * Detect the video service from url
     */
    function detectVideoSearvice($videoUrl) {
        $videoUrl = strtolower($videoUrl);
        if (strpos($videoUrl,'youtube.com') !== false or strpos($videoUrl,'youtu.be') !== false) {
            return 'youtube';
        }
        if (strpos($videoUrl,'dailymotion.com') !== false) {
            return 'dailymotion';
        }
        if (strpos($videoUrl,'vimeo.com') !== false) {
            return 'vimeo';
        }
        return false;
    }

Perhaps I could add something here to define a case ‘html5’ for a number (id 770) and then add the do_shortcode for function renderVideo($videoUrl) case ‘html5’?

  • This reply was modified 10 years by ajayrijh.
Post count: 6535

Hi

The function that you indicated only detect the video service from its url. The result of this function it’s used then in this function: http://screencast.com/t/85tUhwAFEX to render the url in order to display the video. To add video support for a new video network you have to identify a way to retrieve data from it. This is not an easy task and unfortunately I can’t provide a solution now. You can try to modify this function: render_video() and add a new case for your video network if you want.
Please consider that this is a complex tack which require good coding skills and if you don’t know how to do it yourself my advice is to look for someone to help you or hire a developer do do this for you.

Thanks!

Post count: 19

hey Andrei, the solution you provided looks great! I just wanted to ask, I would like to implement the following shortcode when inputting into the Featured Video section on the new post page:

[videoadplayer id= “770”]

The “id” would be unique for the shortcode. How can I adapt the ‘your-shortcode’ text you mentioned in your first reply above so it captures the ID i put into the box? Thanks!

Kind Regards,
Ajay Rijhsinghani

Post count: 6535

Hi

The solution I provided works only with shortcodes from Visual Composer so you have to use a video player like here in order to work: http://screencast.com/t/INPzaKOP4Thttp://screencast.com/t/dx0Z4dKrMV

This is an example code which will work with do_shortcode function:
<?php echo do_shortcode('[vc_row][vc_column][vc_video link="https://www.youtube.com/watch?v=qkeZA6JU3Zw"][/vc_column][/vc_row]'); ?>

The featured video don’t generate shortcode now and you will need a custom implementation to achieve that. You can take a look here for more details about how shortcodes works: https://codex.wordpress.org/Shortcode_APIhttps://codex.wordpress.org/Function_Reference/add_shortcode and evantualy try to create a new shortcode for the featured video.

Hope this help.
Thanks!

  • This reply was modified 10 years by Andrei L..
Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.