In order to set up the self-hosted version of WordPress (WP), you need a host that supports PHP (v.4.3+) and MySQL (v. 4.1.2+). If you want to set up multiple WordPress installations (or use other database-driven software), you will probably want a host that offers multiple MySQL databases.
Note
We suggest a Linux-based (Apache) server. Make sure you get enough storage—at least 1GB. Additional utilities that are helpful for WordPress-based sites include PHPMyAdmin (for working with your database) and SimpleScripts (for installing and updating WordPress).
In this chapter, we will cover:
Developing a strategy with Flash and WordPress
Embedding a
.swf:
via Kimili pluginAdding Flash detection with SWFObject 2.0 and embedding the
.swf
Adding Flash detection with Flash-generated JavaScript and embedding the
.swf
Identify your user level and a specific application. Develop an SEO strategy. Determine what files need to be configured and modified to achieve your goals.
There are an unlimited number of ways to use WordPress and Flash together. The needs, ideas, and abilities of no two users will be the same. The limits are determined by you—by your skill level and the goals you set.
The first step is to identify your level of familiarity with the Web and Multimedia design software. Be honest in your self-assessment—and don't be discouraged, no matter where you are starting today. Understanding your user level allows you to set reasonable expectations. Take a look at the following figures to understand your user level. With practice and experience, by accessing the many free resources available online and through training tools (such as this manual), you will increase your level of proficiency.
You may be a new blogger, or may have been blogging for years. You may be an admin user supporting a team using WP for business or organizational needs, a theme designer, or a plugin developer. This book is written with you in mind, assuming that you are familiar with WP basics, or are willing to become so.


Flash takes care of your dynamic media needs, and WordPress makes it easy to administrate your site. The way to use them together is with SEO in mind.
In terms of density of information presented to a search engine, Flash is not as effective as XHTML, in spite of recent advances. A Flash animation can have a description tag, however, properly marked up XHTML that uses<h1>
and<h2>
to emphasize keywords and phrases, as well as including links to and from authoritative sources, will still have more SEO value when compared to a .swf
.
Many industries and audiences expect or require Flash animations. Your marketing and SEO strategy should determine how you mix WordPress and Flash. The goal is content that people can read and enjoy that is also understood by engines and robots. For those of us who administer or develop websites, ease of use is also a consideration.
In your design, when blocking in space for animations, consider how they are both dynamic and static. An animation does what it does, however lovely it is, and nothing more. Once a user has seen the animation, there is often no reason to pay attention to it again. WordPress offers dynamic content—areas of the page that highlight and excerpt the most recent content from different areas. This encourages users to revisit and explore your site for new content and to pay special attention to dynamic content areas. While an animation measures change in frames per second, WordPress allows your users to measure the changes made since their last visit. In this sense, Web 2.0 represents a true change in technology—transforming the screen itself into an animation that you program—simply by publishing new content.
So, some Flash is almost always fine. But too much Flash is less useful to search engines, relative to XHTML. Additionally, Flash animations generally take more time to update than regular WordPress content.
There are other ideas about how to combine Flash and WordPress, which we will touch on in later and more advanced chapters. Our approach should be applicable to the majority of users.
Flash media can be included anywhere in a WordPress theme: in the header, in a post or a page, in a sidebar, or in the footer. It takes some time to become familiar with your theme files—determining which PHP templates are called when different parts of the screen are clicked. An overview of how WordPress works is useful.
A theme has at least three views, which represent the steps to a given piece of information, moving from home page to a category to a post.
A WordPress home page is traditionally a dynamic display of updates from interior sections (like a dashboard). It can also be a static page. It's often named index.php
or home.php
.
The category archive view is a dynamic display of the posts in a category. It sounds complicated, but it is logical. When a user clicks on a category, not one piece of information is returned, but many. This template is called category.php
.
The archive view is so named because, though this piece of information may be featured in other parts of the site, the user has now arrived at the URL for an individual post. The URL can be used in links or bookmarks to refer back to this specific piece of information. Typically, the format is a long-reading pane.
page.php, sidebar.php, header.php
, and footer.php
work just like you'd think.
Knowing which PHP templates create pages on your blog is the first step to inserting a Flash animation directly into theme files. The next step is to determine specifically which<div>
will contain the animation. Firebug helps us match up the correct<div>
tag with the correct PHP template.
Get Firebug here: http://getfirebug.com/
Firebug is an add-on for Mozilla Firefox. This handy tool allows you to see the CSS and XHTML that make up any page by context-clicking (right-click in Windows or Ctrl-click for Mac) and choosing "Inspect Element." The window splits at the bottom. Bring your mouse down to the bottom-left pane. Hovering over a<div>
tag causes the screen to be highlighted: blue for<div>
width and height, purple for margins, and yellow for padding. Clicking on the blue <div> tag loads the bottom-right pane with entries from the CSS stylesheet that control its appearance. It is helpful to have such a visual representation to understand the structure of a site.
Note
Viewing the source (PC: Ctrl-U/Mac: Cmd-Opt-U) of a WordPress blog can be a confusing experience. Keep in mind that the XHTML output is different than the component PHP. Your templates are not what you see when you "View Source"—rather, you are seeing the result of dynamic PHP calls as XHTML, styled according to CSS. This is what makes WordPress dynamic—there are no webpages. There are only PHP templates waiting to output your website, recreated each time as the most recent content.

There are additional utilities we will be using throughout this book; a FTP client and a text editor are required for intermediate to advanced applications. Dreamweaver is an excellent tool for coding, if you have it. A fast running stand-alone text editor specific to coding has its own merits. Here are open-source utilities for Mac and for PC:
FTP Client: FileZilla, http://filezilla-project.org/download.php
Text Editor: Windows comes with Notepad and Mac has TextEdit, but these text editors are not set up to code for the Web. A text editor for coding gives you access to many additional tools and options, such as line numbers, keyboard shortcuts, and auto-formatting.
PC: NotePad ++, http://notepad-plus.sourceforge.net/uk/site.htm
Mac: jEdit, http://jedit.org
WordPress Theme Hierarchy, Chapter 7
Identify your user level and a specific application. Develop an SEO strategy. Determine what files need to be configured and modified to achieve your goals.
There are an unlimited number of ways to use WordPress and Flash together. The needs, ideas, and abilities of no two users will be the same. The limits are determined by you—by your skill level and the goals you set.
The first step is to identify your level of familiarity with the Web and Multimedia design software. Be honest in your self-assessment—and don't be discouraged, no matter where you are starting today. Understanding your user level allows you to set reasonable expectations. Take a look at the following figures to understand your user level. With practice and experience, by accessing the many free resources available online and through training tools (such as this manual), you will increase your level of proficiency.
You may be a new blogger, or may have been blogging for years. You may be an admin user supporting a team using WP for business or organizational needs, a theme designer, or a plugin developer. This book is written with you in mind, assuming that you are familiar with WP basics, or are willing to become so.


Flash takes care of your dynamic media needs, and WordPress makes it easy to administrate your site. The way to use them together is with SEO in mind.
In terms of density of information presented to a search engine, Flash is not as effective as XHTML, in spite of recent advances. A Flash animation can have a description tag, however, properly marked up XHTML that uses<h1>
and<h2>
to emphasize keywords and phrases, as well as including links to and from authoritative sources, will still have more SEO value when compared to a .swf
.
Many industries and audiences expect or require Flash animations. Your marketing and SEO strategy should determine how you mix WordPress and Flash. The goal is content that people can read and enjoy that is also understood by engines and robots. For those of us who administer or develop websites, ease of use is also a consideration.
In your design, when blocking in space for animations, consider how they are both dynamic and static. An animation does what it does, however lovely it is, and nothing more. Once a user has seen the animation, there is often no reason to pay attention to it again. WordPress offers dynamic content—areas of the page that highlight and excerpt the most recent content from different areas. This encourages users to revisit and explore your site for new content and to pay special attention to dynamic content areas. While an animation measures change in frames per second, WordPress allows your users to measure the changes made since their last visit. In this sense, Web 2.0 represents a true change in technology—transforming the screen itself into an animation that you program—simply by publishing new content.
So, some Flash is almost always fine. But too much Flash is less useful to search engines, relative to XHTML. Additionally, Flash animations generally take more time to update than regular WordPress content.
There are other ideas about how to combine Flash and WordPress, which we will touch on in later and more advanced chapters. Our approach should be applicable to the majority of users.
Flash media can be included anywhere in a WordPress theme: in the header, in a post or a page, in a sidebar, or in the footer. It takes some time to become familiar with your theme files—determining which PHP templates are called when different parts of the screen are clicked. An overview of how WordPress works is useful.
A theme has at least three views, which represent the steps to a given piece of information, moving from home page to a category to a post.
A WordPress home page is traditionally a dynamic display of updates from interior sections (like a dashboard). It can also be a static page. It's often named index.php
or home.php
.
The category archive view is a dynamic display of the posts in a category. It sounds complicated, but it is logical. When a user clicks on a category, not one piece of information is returned, but many. This template is called category.php
.
The archive view is so named because, though this piece of information may be featured in other parts of the site, the user has now arrived at the URL for an individual post. The URL can be used in links or bookmarks to refer back to this specific piece of information. Typically, the format is a long-reading pane.
page.php, sidebar.php, header.php
, and footer.php
work just like you'd think.
Knowing which PHP templates create pages on your blog is the first step to inserting a Flash animation directly into theme files. The next step is to determine specifically which<div>
will contain the animation. Firebug helps us match up the correct<div>
tag with the correct PHP template.
Get Firebug here: http://getfirebug.com/
Firebug is an add-on for Mozilla Firefox. This handy tool allows you to see the CSS and XHTML that make up any page by context-clicking (right-click in Windows or Ctrl-click for Mac) and choosing "Inspect Element." The window splits at the bottom. Bring your mouse down to the bottom-left pane. Hovering over a<div>
tag causes the screen to be highlighted: blue for<div>
width and height, purple for margins, and yellow for padding. Clicking on the blue <div> tag loads the bottom-right pane with entries from the CSS stylesheet that control its appearance. It is helpful to have such a visual representation to understand the structure of a site.
Note
Viewing the source (PC: Ctrl-U/Mac: Cmd-Opt-U) of a WordPress blog can be a confusing experience. Keep in mind that the XHTML output is different than the component PHP. Your templates are not what you see when you "View Source"—rather, you are seeing the result of dynamic PHP calls as XHTML, styled according to CSS. This is what makes WordPress dynamic—there are no webpages. There are only PHP templates waiting to output your website, recreated each time as the most recent content.

There are additional utilities we will be using throughout this book; a FTP client and a text editor are required for intermediate to advanced applications. Dreamweaver is an excellent tool for coding, if you have it. A fast running stand-alone text editor specific to coding has its own merits. Here are open-source utilities for Mac and for PC:
FTP Client: FileZilla, http://filezilla-project.org/download.php
Text Editor: Windows comes with Notepad and Mac has TextEdit, but these text editors are not set up to code for the Web. A text editor for coding gives you access to many additional tools and options, such as line numbers, keyboard shortcuts, and auto-formatting.
PC: NotePad ++, http://notepad-plus.sourceforge.net/uk/site.htm
Mac: jEdit, http://jedit.org
WordPress Theme Hierarchy, Chapter 7
The most basic and fundamental way of using WordPress and Flash together is to insert an animation. The steps are:
1. Create an animation in Flash.
2. Export the animation as a
.swf
.3. Upload the
.swf
to your server.4. Embed the
.swf
in your site.
WordPress makes it easy to embed a .swf
—here, we provide an in-depth review of the Kimli Flash Embed Plugin, (version 2.0.2) based on Swfobject 2.x.
If you do not have an animation to begin with, this section uses a sample Flash animation, found in theChapter 1 folder.
WordPress displays Flash the same as any other web page—through Flash Detection. Flash developers use swfObject 2.x and JavaScript for Flash Detection. Otherwise, non-specialists can use one of a variety of plugins to embed Flash media (SWF or FLV). Kimli Flash Embed is among the best of such plugins.
The easiest way to embed Flash in WordPress is through the plugin "Kimili Flash Embed for Wordpress."
http://kimili.com/plug-ins/kml_flashembed/wp
"Built upon the SWFObject javascript code, it is standards compliant, search engine friendly, highly flexible and full featured, as well as easy to use." Quoted from http://kimili.com/plug-ins/kml_flashembed/#usage (2009).
Installing Kimili Flash Embed (KFE) on your WordPress site is simple.
1. In your dashboard sidebar, use the downward pointing arrow to expand Plugins and then click on Add New.
2. In the Search bar, type: flash, as seen in the following screenshot.


4. Now that the plugin has been uploaded and activated, the final step is to insert a Flash file in the
.swf
format.5. Click on Posts | Edit and then the relevant post title (we will be using the default Hello world! post).
6. Click on HTML to enter the HTML view.
Note
To add a Flash animation, use the following shortcode, replacing path, y and x parameters with the respective path, height, and width of your swf:
[kml_flashembed movie="/path/to/your/movie.swf" height="y" width="x" /]
7. The
movie
parameter is the only one required—height and width are optional. Though it is most efficient to size your.swf
during export, the height and width parameters will resize a.swf
file. If you do so, be sure to keep the numbers in scale proportion to avoid distortion For reference, look at the following screenshot.

8. If you're using the Visual Editor to write your posts, look for the red Flash button on the right. Click to launch the KFE Tag Generator, a wizard-like interface that will assist you in creating the necessary KFE tag. Again, the only necessary parameter is the URL to the .swf file you want to display.
That's it! You have now inserted your first Flash animation inside WordPress. It's easy to do through the shortcode or the KFE Tag Generator. Open another tab (PC: Ctrl + T /Mac: Cmd + T) to confirm:

Detect which version of the Flash Player a viewer has available and supply alternative content in the event that the necessary Player is not available. The alternative content, in this case, will be a link for the viewer to acquire the appropriate Flash Player, if desired. To assist in expressInstall of the Player, the .swf will be registered with SWFObject. This method of setting up Flash Player detection does not require the use of a plugin and gives you easy and direct access to the generated code.
SWFObject 2.x is an open-source application brought to you by Google. To view the open-source license for SWFObject 2.x, please visit http://www.opensource.org/licenses/mit-license.php. For further information on SWFObject and for another download source for the files needed to enable it to work, please visit http://code.google.com/p/swfobject/.
For supplemental information regarding SWFObject 2.x from Adobe, please visit http://www.adobe.com/devnet/flashplayer/articles/swfobject.html for an article entitled Detecting Flash Player versions and embedding .swf files with SWFObject 2.0, created by Bobby Van Der Sluis.
In theChapter 1 folder, make sure that you have access to the following files: swfobject_test.swf, expressInstall.swf, swfobject.js
, and detection_generator.htm
. They are located inside the Detection with SWFObject
folder.
Move the swfobject_test.swf, expressInstall.swf
, and swfobject.js
files to the root level of your theme folder. Technically, the .swf
you are embedding can be located anywhere, as long as you use the absolute URL in your code.
The detection_generator.htm
file holds the open-source application that generates the necessary Flash Player detection code for you to put into your PHP template.
Be aware that hand coding your live website is a great way to learn and a fast way to work. You are probably going to make a few mistakes the first time through. It is in your best interest to have all of your information backed up before editing your site. You may want to have a text editing program or a WYSIWYG editor like Dreamweaver to maintain and organize copies of your files at each stage of development.
Another option is to set up WordPress locally so that the program runs on your computer instead of a server. XAMPP is a cross-platform utility that can help set up the Apache web server on your computer. You can download it here: http://www.apachefriends.org.
The benefit of this approach is that you do not have to upload files via FTP or reload pages to see the changes you've made. Also, your work in progress will be private—no one will be able to see your site until you move your completed site from the local install to your server.

2. For the SWFObject configuration section, leave the default settings for SWFObject (.js) as swfobject.js and for Publishing method as Static Publishing. Change Detect Flash Version to the version of the Flash Player appropriate for your animation. For example, the default of 9.0.0 is adequate. If you are using the latest and greatest capabilities of Flash CS4, instead change the version to 10.0.0. Check the box for Adobe Express Install and leave the file name as it is. This can be seen in the above screenshot.
3. For the SWF definition section, change the name of the Flash (.swf) to the name of your
.swf
file. In this case, change it to:swfobject_test.swf
. Dimensions need to be changed to the width and height of your.swf
file. Change this to 320 x 240 pixels. Flash content id can stay as the default. This can also be seen in the above screenshot.4. For the HTML definition section, do not change anything.
5. Click the Generate button to generate the necessary Flash detection code in the window at the base of the application. Kimili generates the code and puts it into your WordPress shortcode. The SWFObject 2.x generator gives you direct access to your code. You then have to copy/paste the code to the appropriate location in your chosen template in WordPress. Your code should look like the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> swfobject.registerObject("myFlashContent", "10.0.0", "expressInstall.swf"); </script> </head> <body> <div> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240" id="myFlashContent"> <param name="movie" value="swfobject_test.swf" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="swfobject_test.swf" width="320" height="240"> <!--<![endif]--> <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /> </a> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </div> </body> </html>
6. Select the <div> tag in the body section of the code. Everything from
<div>
to</div>
gets selected. Copy this (Edit | Copy or Ctrl-C).7. In the sidebar of your WordPress Dashboard, click on the arrow to the right of Appearance. Then, click on Editor.
8. On the right side of the screen, you now have a list of all the templates that are in the root directory of the
Theme
folder. Click on the title of the desired.php
file. This loads it in the Theme Editor.9. Paste the code you copied from the code generator (Edit | Paste or Ctrl-V) into the appropriate Template and <div> tag. Refer back to Developing a Strategy: Where to Place a .swf? if needed.
10. For the head content, select and copy the following:
<script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> swfobject.registerObject("myFlashContent", "10.0.0", "expressInstall.swf"); </script>
Back in WordPress, open up header.php
by clicking on Appearance | Editor | header.php
. Paste the selected text in the head section after the</style>
tag and before the</head>
tag.
The code generator creates the code for you based on the choices you make. It generates the code within the basic structure of an HTML page. The code generated is web standards compliant and supports the incorporation of alternative content.
The JavaScript elements in the<head>
section of the .htm
generated HTML output accesses the swfobject.js
file. This is a library of JavaScript necessary for the Flash Player version detection process to take place. The JavaScript elements also register your .swf file with the library and tell it which version of the Flash Player is needed.
In the body section of the document, a <div> tag is created that holds the object and nested object information/method that delineates which .swf
is to be played, the width and height of it, and what alternative content to display if the appropriate Flash player version is not found. Notice that special coding is used to account for the needs of Internet Explorer, for example:<!--[ if !IE]>-->
If you want have your .swf dimensions relative (in percentages) instead of absolute (in pixels), you have two choices:
Choice #1:
1. Go back into the
detection_generator.htm
file.2. Change the Dimensions to 100 x 100 percentage, as seen below.

3. Click Generate.
4. Copy/paste your new code as needed.
Choice #2:
In WordPress, change the dimensions in pixels to dimensions in percentages. That section of code should look like this:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="myFlashContent"> <param name="movie" value="swfobject_test.swf" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="swfobject_test.swf" width="100%" height="100%"> <!--<![endif]-->
The default setting for the detection_generator.htm
file is for Static Publishing. The other choice is Dynamic Publishing. Static Publishing is able to reach a larger audience because of the way it is constructed. There is less dependency on JavaScript. The downside is minimal. As per Adobe's Bobby Van Der Sluis, Static Publishing does not have a solution for click-to-activate mechanisms. However, those are already being phased out of use (Internet Explorer and Opera were the browsers of interest with this). Dynamic Publishing relies more heavily on JavaScript, even for embedding the .swf file, so the audience reached is smaller. A couple of perks are that it generates less code and has no issue with click-to-activate mechanisms.
1. All you have to do to change the publishing method is open the
detection_generator.htm
file and change Publishing method to Dynamic Publishing, as seen below, leave the defaults as desired, and click Generate.

2. Notice there is slightly different and slightly less code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> var flashvars = {}; var params = {}; var attributes = {}; swfobject.embedSWF("swfobject_test.swf", "myAlternativeContent", "320", "240", "10.0.0", "expressInstall.swf", flashvars, params, attributes); </script> </head> <body> <div id="myAlternativeContent"> <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /> </a> </div> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> var flashvars = {}; var params = {}; var attributes = {}; swfobject.embedSWF("swfobject_test.swf", "myAlternativeContent", "320", "240", "10.0.0", "expressInstall.swf", flashvars, params, attributes); </script> </head> <body> <div id="myAlternativeContent"> <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /> </a> </div> </body> </html>
3. Copy/paste the necessary parts of this code into WordPress.
More options are available to you in the SWF definition section of the code generator. Click the More button to see them (they will look like the image below):

Choose and change Attributes and Parameters here if you would like the generator to create even more code for you. Many of these options are most useful when the .swf
you are embedding is going to be the sole content of the .html
page.
If you are doing a test run, you may want to change the quality setting to low to cut down on load time. Just remember to turn it back to the default or high when you are ready for the real deal.
If you want to add Flash player detection to your web page, but do not want to reference an external file, this recipe offers an easy solution. Use the Flash Professional IDE to generate the .html
page for you that contains JavaScript to detect a Flash player and will play your .swf
. Then, copy/paste the needed code into your template in WordPress.
Make sure you have access to the javascript_test.fla
file so that you can open the file and allow Flash to generate additional files in that same location. It is currently located in the Detection with Flash JavaScript
folder inside the folder forChapter 1. Change the location of this file as you need.

3. Make sure that Flash and HTML are checked, as shown in the previous screenshot.
4. Click on the Flash tab at the top of the dialog box, as seen below.

6. Click on the HTML tab at the top of the dialog box, as seen below.

7. In the top section of the dialog box now showing, set the Template to either Flash Only or Flash HTTPS, check the box for Detect Flash Version, and type in the specific version of Flash to be targeted.
8. Click Publish at the bottom of the dialog box. A
.swf
file and.html
file have now been created for you. The.html
file holds a reference to the.swf
as well as the JavaScript necessary for basic Flash Player detection.9. The
.swf
can be moved to the root level of your site as needed.10. Copy/paste the Flash detection code into a Template in WordPress.
You enter the necessary preferences for your .swf and .html
files into the Publish Settings dialog box. When you click Publish, Flash generates the requested files. As long as the .html
template you publish is either Flash Only or Flash HTTPS, the .html
file will be generated with JavaScript, set up to detect the Flash Player you specified. If the appropriate Flash Player version is not detected, alternative information is displayed so that the viewer has the option to download the targeted and necessary version of the Flash player.