Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Excerpts, Read more, Pagination (http://forum.bytesforall.com/forumdisplay.php?f=20)
-   -   How to enter a php script (http://forum.bytesforall.com/showthread.php?t=1286)

bilalasd Apr 15, 2009 08:46 PM

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.

Flynn Apr 16, 2009 09:51 AM

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 } ?>

bilalasd Apr 16, 2009 03:53 PM

Thank you very much for your help. It worked


All times are GMT -6. The time now is 11:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.