• Resolved sledgedesign

    (@sledgedesign)


    First of all, thanks for all the work you’ve done putting this together and staying active on the forums. This is my first foray into WP and I’m setting up a CMS for a client website using this plugin. I have created a custom field so the client can enter a url for a video on vimeo, youtube, etc. The video will need to display on the page outside the body of the post. I am trying to use the following in my custom template:

    <?php echo do_shortcode('[embed width="536" height="298"]https://vimeo.com/18577052[/embed]'); ?>

    I have gotten contact form 7 to work using the do_shortcode function and the shortcode that it provided, so I am wondering why the function is not working with [embed] shortcode. Of course, once I get a static link working I plan on replacing that with a call to my custom field for the url.

    Any suggestions? Thanks in advance.

    https://www.ads-software.com/extend/plugins/custom-content-type-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Does that embed code above work if you put it into your main content field? I would want to make sure the shortcode by itself worked before trying any variations on it.

    You can put shortcodes in your custom fields an they get parsed if you use the “do_shortcode” output filter. If you’re having the user paste the URL to the video, I would skip the shortcodes entirely: they’re really only useful in the WYSIWYG fields because WP strips out a lot of HTML and Javascript tags. Why not just put the raw HTML in your template and print the URL?

    <embed src="<?php print_custom_field('my_video_url'); ?>" height="100" width="200"/>

    Or perhaps more aesthetically pleasing, use the wrapper output filter:

    <?php print_custom_field('my_video_url:wrapper', '<embed src="[+content+]" height="100" width="200"/>'); ?>

    Thread Starter sledgedesign

    (@sledgedesign)

    Thanks for the quick response. The embed code will work in the main content field using the wrapper class example you provided.

    I plugged in both the suggestions you gave with the same results – using the standard vimeo video URL, a placeholder will load on the page at the specified size, but the browser will automatically launch a new window or redirect the current window to the link specified in the embed code (the video never loads on the wordpress page in the placeholder).

    One note that may be relevant: Vimeo provides html to embed an iframe in the page for any video. The src="" URL contained within their embed chunk is formatted like so: player.vimeo.com/video/theVideoNumber. Using the second of your suggestions, I can get a video to load in Safari using this URL rather than the standard video URL (e.g. vimeo.com/TheVideoNumber) but FF does not display anything.

    I was under the impression that the [embed] shortcode for WP would be able to embed the video content from the standard video URL from any number of services, which is why I was attempting to use it.

    Thoughts?

    Thanks again.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Ok, if the embed code works when you put it in the main content block, that proves that WP can parse that code, so that’s good.

    If the browser launches a new window with that video, then it sounds like an HTML problem. Have you viewed the source of the generated page and compared it to the HTML you expect to see? Make sure you try the embed HTML in a static page (outside of wordpress) and verify that the HTML works the way you expect it to… if the static HTML doesn’t work the way you expect it to, then your problem is the HTML: dynamically generating bad HTML won’t magically heal it.

    The embed tag is supported by all major browsers, but it would require that your browser has a plugin installed that will handle the displaying of the thing you are embedding… maybe your FF doesn’t have a valid plugin for it.

    No matter how you do this, you need to ensure that 1) the basic HTML works statically, e.g. does this work on a page? (Or try the iframe variation… just make sure that basic static HTML works):

    <embed src="https://player.vimeo.com/video/1234" height="100" width="200"/>

    And 2) is that what’s getting generated by the pages? This seems like it’s just basic stuff here: make sure the HTML works, then make sure whatever you’re doing generates that HTML format. I don’t think the CCTM is involved with this at all, frankly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Custom Content Type Manager] using [oembed] on post templates’ is closed to new replies.