Category Archives: Articles

Different flash films in header

For a project I´m working on at the moment I was looking for an easy way to have different header flash films in a wordpress-driven website. I didn´t want to have a header.php for each flash film, so I tried to find a way to achieve this by using some php. I´m not a programmer and not very familiar with php but the wordpress codex is a very good resource. I found out how to work with conditional tags. Basically the concept is this:

All of the Conditional Tags test to see whether a certain condition is met, and then returns either TRUE or FALSE.

WordPress Codex

So I just had to find out on every page if it was the home page, a single page or a archive page. I used just basic php code for this. I placed this code where the <object...> formerly was placed:

<?php

    if (is_home())
    {
    echo '<object type="application/x-shockwave-flash" data="home.swf" width="760" height="400">
    <param name="movie" value="home.swf" /></object>';}

    elseif (is_single()) 
    {
    echo '<object type="application/x-shockwave-flash"data="single.swf" width="760" height="400">
    <param name="movie" value="single.swf"/></object>';}

    else
          {
          echo '<object type="application/x-shockwave-flash" data="/flash/news.swf" width="760" height="400">
          <param name="movie" value="/flash/news.swf" />
          <img src="news.jpg" width="760" height="300" alt="news" />
          </object>';}
?>

This is basically it. If you want more information, read the aforementioned wordpress codex page.