WordPress.org

Ready to get started?Download WordPress

Forums

Help implementing html code into page (3 posts)

  1. Veloncia2
    Member
    Posted 1 year ago #

    Im trying to put this code on a wordpress page but it just shows up blank. There isnt anything wrong in the code, becuase it works fine when the code is on a html page. Any help with telling me why it wont show up, or another way to display this html correctly without haveing to link to another source(ex. iframe). Thanks in advance

    <div style="width:650px; height:370px;">
    <style type="text/css">
    body,html {padding: 0px; margin: 0px; background: #000; font-family: Arial, Tahoma, Helvetica; color: #fff; font-size: 14px;}
    #flowplayer {text-align: center; width: 650px; height: 370px;}
    </style>
    
    <script type="text/javascript" src="http://www.auengine.com/js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="http://www.auengine.com/js/flowplayer-3.2.6.min.js"></script>
    </head>
    <body>
    
    <div id="flowplayer"></div>
    <div id="ret"></div>
    <script type="text/javascript">
    $(function() {
    
    							$f("flowplayer", {src: "http://www.auengine.com/flowplayer/flowplayer.commercial-3.2.14.swf", wmode: 'transparent'},  {
    								canvas: {
    									backgroundColor: 'transparent',
    									backgroundGradient: 'none'
    
    								},
    
    								showErrors: false,
    								onError: function(errorCode){
    
    									if(errorCode == 303) {
    
    											$f().play(1);
    
    									}
    																	},
    								contextMenu: ["AUEngine"],
    								key: "#$b74d0ff1ab664c44d8c",
    								plugins:{
    									controls: {
    										url: "http://www.auengine.com/flowplayer/flowplayer.controls-3.2.13.swf",
    										zIndex: 3,
    										backgroundColor: "rgba(0,0,0,0.5)",
    										backgroundGradient: "none",
    										height: 37,
    										volumeColor: "#0066ff",
    										hideStyle: "move",
    										timeColor: "#ffffff",
    										durationColor: "#0066ff",
    										bufferColor: "#222222",
    										progressColor: "#0066ff",
    										buttonOverColor: "#eeeeee"
    									},
    									lighttpd: {
    												url: 'http://www.auengine.com/flowplayer/flowplayer.pseudostreaming-3.2.9.swf',
    												queryString: escape('&start=${start}')
    									},
    									yume: {
    										url: 'http://www.auengine.com/flowplayer/flowp_new.swf',
    										yume_library_swf_url: 'http://www.auengine.com/flowplayer/adlib_new.swf',
    										yume_preroll_playlist: 'http://plg1.yumenetworks.com/dynamic_preroll_playlist.fmil?domain=1042VRjgXlKU',
    										yume_midroll_playlist: 'http://plg1.yumenetworks.com/dynamic_midroll_playlist.fmil?domain=1042VRjgXlKU',
    										yume_postroll_playlist: 'http://plg1.yumenetworks.com/dynamic_postroll_playlist.fmil?domain=1042VRjgXlKU',
    										yume_branding_playlist: 'http://plg1.yumenetworks.com/dynamic_branding_playlist.fmil?domain=1042VRjgXlKU',
    										support_preroll: 'true',
    										support_leader: 'true',
    										support_midroll: 'true',
    										support_postroll: 'true',
    										support_branding: 'true',
    										support_watermark: 'true',
    										preAsMid: 'true',
    										preAsPost: 'true',
    										excludeExt:'.jpg,.png',
    										controlsHeight: '37',
    										normalscreen_x: '0',
    										normalscreen_y: '0',
    										normalscreen_width: '640',
    										normalscreen_height: '360',
    										zIndex: 2
    									}
    
    								},
    								playlist:
    								[
    								{
    												url: 'http://s3.auengine.com/thumb/waiDa3St_b.png',
    												scaling: 'fit'
    
    								},
    								{
    
    												url: 'http://s45.auengine.com%2Fvideos%2FwaiDa3St.mp4%3Fst%3DAiqNhXcy9HySE9EaK0xTlg%26e%3D1372404468',
    												autoPlay: false,
    												scaling: 'fit',
    												autoBuffering: false,
    												provider: 'lighttpd'
    
    								}
    								]
    
    							});
    						});
    </script>
    	</body>
    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-24380888-1']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
    <img src="http://whos.amung.us/widget/2n2hvc4w8l4o.png" width="1px" height="1px" alt="" />
    </div>
  2. Shaun Scovil
    Member
    Posted 1 year ago #

    The WordPress post/page editor strips away PHP and JavaScript for security reasons, because that content is stored in your MySQL database and allowing it would make you vulnerable to SQL injections.

    If you need to add JavaScript or PHP, consider creating a separate PHP file (ex: custom.php) in your theme folder. Put the above code in that file, then add this to your functions.php file:

    function my_custom_template_part( $atts ) {
        ob_start();
        get_template_part( 'custom' );
        return ob_get_clean();
    }
    add_shortcode( 'custom', 'my_custom_template_part' );

    Finally, use the shortcode [custom] in your post or page to display the template part.

  3. Shaun Scovil
    Member
    Posted 1 year ago #

    You could make that shortcode function more versatile by accepting template $slug and $name parameters, like this:

    function my_custom_template_part( $atts ) {
        $slug = isset( $atts['slug'] ) ? $atts['slug'] : 'custom';
        $name = isset( $atts['name'] ) ? $atts['name'] : null;
        ob_start();
        get_template_part( $slug, $name );
        return ob_get_clean();
    }
    add_shortcode( 'custom', 'my_custom_template_part' );

    That would allow you to use a shortcode like [custom slug=foo name=bar], which would first look for a file called foo-bar.php in your theme folder, then fall back on foo.php if foo-bar.php is not found.

Topic Closed

This topic has been closed to new replies.

About this Topic