567 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
iamdok says

Hi guys,

I have a buyer of my latest Flash banner over on Activeden who is trying to place it into the main page on their Wordpress Website, and they are having trouble.

I don’t have any experience of placing Flash objects in Wordpress sites specifically, but I imagine it’s much the same as placing it into a normal html page. (This I have experience of).

So can anyone tell me if there is anything specific to Wordpress websites which I should be aware of? And btw this item uses javascript code to feed mouse X & Y position back to the Flash Banner, to continuously reposition elements, so the embed code would need to bring this javascript with it.

Here is the embed code for a normal html page + reposition js code. Does this need to change for Wordpress?

http://pastie.org/1070512

Thanks,

Donagh

469 posts
  • Author had a File in an Envato Bundle
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 4-5 years
  • India
+1 more
SaurabhSharma says
Hi Donagh,

If this flash is working fine in normal HTML page, it would be good if you embed entire HTML code into a php PAGE Template. i.e. Create a Wordpress page template with all this code inside it. Next, assign this template to the home page inside Wordpress. I guess there already would be a home page template. You just need to insert this code appropriately within php tags.

567 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
iamdok says

Hi SaurabhSharma,

Yes there is already a home page template, so in this case what you are saying is that the whole javascript swfObject code and the mouse position code is simply wrapped in php tags and inserted into the appropriate div?

Cheers,

Donagh

469 posts
  • Author had a File in an Envato Bundle
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 4-5 years
  • India
+1 more
SaurabhSharma says

Nope. Not everything inside page template. The swfObject JS call and other head scripts should be included inside header.php. The body specific code (where you are checking mouse X and Y positions) should be included inside that particular PAGE template.

If your buyer knows how to do that, he will get an idea. Optionally, he can include some conditional checks inside header.php to hide those script calls from rest of the pages. (This is not required though. Just for efficiency. So that those scripts do not load unnecessarily on other pages).

Something like this:

header.php
----------------

<!-- JAVASCRIPT FILES -->
<script src="<?php bloginfo('template_url'); ?>/javascript/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
    var vars = { xmlPath:'<?php bloginfo('template_url'); ?>/xml/follow_banner_3d.xml'};
    var params = { scale:'noScale', salign:'lt', menu:'true', wmode:'transparent', allowfullscreen:'true', allowscriptaccess:'always' };
    var attributes = {};
    swfobject.embedSWF("follow_banner_3d.swf", "flashContent", "1000", "500", "10.0.0", "javascript/express_install.swf", vars, params, attributes );
</script>

//If the variables do not work directly, try to use bloginfo('template_url') in a separate var and pass them in swfObject.embedSWF()

Home Page Template
---------------------------------

<?php /*
Template Name: Home
*/
<script language="JavaScript1.2?> 
        - Body specific script for mouse X Y Pos here -

//rest of the HTML or PHP code

?>

This is just an overview for your idea. Final code will be much different.

567 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
iamdok says

Thanks a million for your help, and you time.

This will hopefully be enough to sort it out.

Regards,

Donagh

506 posts
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • United Kingdom
Gareth_Gillman says

put php command in the page.php / index.php (are they running a static homepage or a list of blog posts?

Just use the wp command if_is_home() { e.g.

 <?php if_is_home() {
  code for flash banner
 } ?>

Put that code where they want to put the slider, make sure they edit the page in the code editor (appearance > editor).

1028 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 500 and 999 users
+1 more
ThemeBlvd says
Just use the wp command if_is_home() { e.g.
 &lt;?php if_is_home() {
  code for flash banner
 } ?&gt;

Didn’t really read this whole thread in detail, but just a note to correct the above…

if( is_home() ) {
    ...code here...
} 
by
by
by
by
by
by