Title: Help creating plugin
Last modified: August 18, 2016

---

# Help creating plugin

 *  [ssdesign](https://wordpress.org/support/users/ssdesign/)
 * (@ssdesign)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/)
 * Hi,
    I am a starter and would be happy to get some help in creating a plugin.
 * What I want to achieve is, display a Flash Movie (example: myMovie.swf) from 
   a “plugins/myPlugin” folder by inserting a PHP code in the template PHP code.
 * Looks simple but cant get to it 🙁
 * Here is my existing code:
 * `
    <?php
 * /*
    Plugin Name: Plugin URI: Description: Author: Version: Author URI: */
 *  add_action('the_content', 'my_function');
 *  function my_function()
    {
 *  $output = "<object type=\"application/x-shockwave-flash\" data=\"$filename\"
   width=\"600\" height=\"212\"><param name=\"movie\" value=\"$filename\" /></object
   >";
    return $output; } ?>
 * After activating the plugin, I added this code to the index.php (header):
 * `
    <?php get_header(); ?>
 * <?php if (function_exists('my_function')) : ?>
 * <?php my_function(); ?>
 * <?php endif; ?>
 * When I use this code, the flash movie gets embeded in every post.
 * Any help??

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [lynk](https://wordpress.org/support/users/lynk/)
 * (@lynk)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273314)
 * If your flash is showing in every post, you propably added the code within the
   post loop. Add it in the sidebar.php file and see if that works.
 *  Thread Starter [ssdesign](https://wordpress.org/support/users/ssdesign/)
 * (@ssdesign)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273324)
 * I have placed the code right after the get_header() function as shown above.
 * If I view the source of the resulting page, this is what I find:
 * Immediately after the line:
    <small>October 5th, 2005 <!– by Administrator –>
   </small>
 * I get my flash code:
 * <div class=”entry”>
    <object type=”application/x-shockwave-flash” data=”” width
   =”600″ height=”212″><param name=”movie” value=”” /></object> </div>
 * The code gets wrapped inside a DIV with class ENTRY.
 * If you look at my plugin code, I hve not specified any DIV, this ENTRY DIV gets
   added automatically.
 * Do I need to change this line in my plugin???
 *  add_action(‘the_content’, ‘my_function’);
 * Could this be the problem?
 *  [TechGnome](https://wordpress.org/support/users/techgnome/)
 * (@techgnome)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273328)
 * This is culprit: ` add_action('the_content', 'my_function');`
 * You’ve hooked it to the content. So everytime the content is displayed, your 
   flash movie is shown.
 * What is it exactly that you are trying to achieve? At what times, and where do
   you want the movie to be shown? And at what times do you NOT want it shown?
 * -tg
 *  [lynk](https://wordpress.org/support/users/lynk/)
 * (@lynk)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273332)
 * ahh yeah. techgnome is right.
 *  Thread Starter [ssdesign](https://wordpress.org/support/users/ssdesign/)
 * (@ssdesign)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273394)
 * Ok so let me describe what i am trying to do.
 * With this plugin, i want to add a carton strip just below the header. It will
   be a ‘Daily Dilbert’ cartoon updated daily using the dilbert RSS feed.
 * So in effect, i has to appear only once. Just before the first blog entry is 
   displayed.
 * This is the reason why i was copying the code immediately after the head tag 
   like this:
 * <?php get_header(); ?>
 * <?php if (function_exists(‘my_function’)) : ?>
    <?php my_function(); ?> <?php
   endif; ?>
 * Can you guide me to the right way?
    Also this plugin will be made public once
   i get it working.
 * Thanks.
 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273404)
 * if you >explicitly< have a call to my_function within index.php, you don’t need
   to have add_action(‘the_content’, ‘my_function’)… the index.php call does everything
   you need. get rid of the add_action call, and it should work fine.
 * -d
 *  Thread Starter [ssdesign](https://wordpress.org/support/users/ssdesign/)
 * (@ssdesign)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273406)
 * thanks david, i will give it a try and post the development soon.
 *  Thread Starter [ssdesign](https://wordpress.org/support/users/ssdesign/)
 * (@ssdesign)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273615)
 * hi David, It solved my rpoblem.
 * Thanks

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Help creating plugin’ is closed to new replies.

## Tags

 * [flash](https://wordpress.org/support/topic-tag/flash/)

 * 8 replies
 * 4 participants
 * Last reply from: [ssdesign](https://wordpress.org/support/users/ssdesign/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/help-creating-plugin/#post-273615)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
