How to enter a php script
Hi, I am trying to make a flash gaming website with wordpress and I have this piece of code
<embed src="<?php echo get_post_meta($post->ID, "swf_url", true); ?>" menu="false" quality="high" width="<?php echo get_post_meta($post->ID, "width", true); ?>" height="<?php echo get_post_meta($post->ID, "height", true); ?>" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> that I found somewhere on the internet it embeds swf file in the post and the swf url depends on the post id. I had to put this somewhere in the post section of the index.php and I did put it under the "<!-- Post Body Copy -->" heading and it shows the swf file. But the problem is that on the front page it shows the whole game even though I have setted up in the settings to show only excerpt. Can anyone tell me what am I doing wrong.Am I placing the code in the wrong place? If you wanna see where the code is you can see it at my site http://www.brgamez.com in the source code. |
Wrap your code into a condtional statement to have it appear on single post pages only
<?php if ( is_single() ) { ?> <embed src="<?php echo get_post_meta($post->ID, "swf_url", true); ?>" menu="false" quality="high" width="<?php echo get_post_meta($post->ID, "width", true); ?>" height="<?php echo get_post_meta($post->ID, "height", true); ?>" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> <?php } ?> |
Thank you very much for your help. It worked
|
All times are GMT -6. The time now is 01:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.