Viewing 1 replies (of 1 total)
  • what do you mean?
    the custom field has the name/url of the swf you want to load?

    just in case, here’s a sample script

    <head>
    	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
    </head>
    <body>
    <!--SOMEWHERE IN THE BODY-->
    	<div id="flashcontent"></div>
    
    <!--AFTER THE LOOP-->
    <?php if (get_post_meta(get_the_ID(), 'which_swf', true)) :
    		// the custom field name is 'which_swf'
    		// the value of this custom field is like "your-file.swf"
    		// the swf files are stored inside the 'custom' directory
    		$the_swf=site_url().'/wp-content/custom/'.get_post_meta($post->ID, 'which_swf', true);
    		?>
    <script type="text/javascript">
    	var flashvars = {};
    	var params = {id: "flashcontent", wmode: "opaque", menu: "false", quality: "high", bgcolor: "#000000", allowFullScreen: "true"};
    	var attributes = {id: "flashcontent"};
    	swfobject.embedSWF("<?php echo $the_swf ?>", "flashcontent", "400", "200", "10", null, flashvars, params, attributes);
    </script>
    <?php endif; ?>
    </body>

Viewing 1 replies (of 1 total)
  • The topic ‘How do you embed .swf or .flv file as custom fields?’ is closed to new replies.