Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
First Plugin
#2
angelazou Wrote:Hi all,

I'm looking to create my first plugin here in GS. It's going to be very simple, just making vTicker available as a plugin to display rolling news on the sidebar, or anywhere in the page. I need some advice, and I have read the plugins wiki, but I'm still not clear on a few bits.

Here is my plan: I will need two files, jquery.js and vticker.php. I will
1. Create a submenu in theme tabs, used for configuring options and news content in vticker.
2. Content of vticker.js will be included into vticker.php as embedded JS. This JS code will need to be placed into header.php when placed on a page.
3. Dynamically, using PHP, to configure options and insert news content.
4. Create tags to place the content of vTicker.
5. Include additional styling options.

I'm having issues at point 2 and 4,
- Point 2: how do I place this piece of code into header.php using the plugin PHP file that I have?
- Point 4: how do I create a tag to be inserted in pages?

Regards,
Angela

4. It's just a function (maybe with parameters) in your plugin that will be called in your template or a component, e.g.
Code:
<?php get_vticker(); ?>

2. You don't need to put the JS into the header, just include it in the body when above function is called. As for jQuery, you can either state in your plugin's requirements that jQuery has to be included in the template, or if you include it yourself (where the function is called), you must provide an option to switch off inclusion.

2./5. If you want to have the JS, jQuery and possibly css styles in the header, you can use the hook theme-header.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply


Messages In This Thread
First Plugin - by angelazou - 2011-06-05, 01:16:25
First Plugin - by mvlcek - 2011-06-05, 01:50:43
First Plugin - by angelazou - 2011-06-05, 02:05:40
First Plugin - by mvlcek - 2011-06-05, 02:19:57



Users browsing this thread: 1 Guest(s)