WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [WP-FLV] outputting different mark-up (1 post)

  1. ryanoz
    Member
    Posted 6 years ago #

    so I'm trying to add FLV movies to WP pages using WP-FLV, but I want to have the flash player detection and alternative content. So I like the way flv files are embeded with the SWFobject method, which will detect the player and if the player is not detected it can offer an "express install" without leaving the site. Since you can't just add the SWFobject markup into a wordpress page (WP strips the markup and adds <p>tags)... I found in the WP-FLV where it outputs the markup to embed the flash movie and changed it to match the SWFobject method and added the swfobject.js script to the header:
    http://code.google.com/p/swfobject/wiki/documentation
    I'm sure some people may have a problem with me changing this, but its the only way I know to get this markup INTO a WP page and still have the client manage their content with visual editor. So all I did was changed the output to look like that in the link above starting at the <object>:

    function wpflv_replace($content){
    $o = wpflv_get_options();
    
    $flvVars = array("PLAYER", "HREF", "WIDTH", "HEIGHT", "AUTOSTART");
    $flvVals = array($o['playerurl'], '', $o['width'], $o['height'], $o['autostart']);
    if ($o['xhtmlvalid'] == 'y'){
    $flvCode = <<<EOT
    <object id="flvObject" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="%WIDTH%" height="%HEIGHT%">
    <param name="movie" value="%PLAYER%?file=%HREF%" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="%PLAYER%?file=%HREF%" width="%WIDTH%" height="%HEIGHT%">
    <!--<![endif]-->
    <div>
    <h6>Alternative content</h6>
    <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
    </div>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
    </object>
    EOT;
    }

    Then I added
    <flv href="movie.flv" autostart="false" width="300" height="275" />
    to my page and everything is perfect except there is a <p> tag added for some reason that is screwing the whole thing up.

    The output:

    <div id="flvPlayer"><object id="flvObject" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="295"><param name="movie" value="url_to_flv_payer.swf?file=movie.flv" /><!--[if !IE]>–><br />
    <object type="application/x-shockwave-flash" data="url_to_flv_payer.swf?file=movie.flv" width="300" height="295"><br />
    <!--<![endif]--></p>
    <div>
    <h6>Alternative content</h6>
    <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
    </div>
    <p><!--[if !IE]>–><br />
    
    </object><br />
    <!--<![endif]--><br />
    </object></div>

    you can see it is adding <br /> tags and <p></p> tags.
    So it has to be WP automatically formatting the output, but I turned that off in the settings. So I guess the short of it is... how do you keep WP from adding in the extra tags?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.