Using Attributes

Attributes is a special and useful feature of Shortcoder wordpress plugin. It allows to change the content of the shortcode as you like with a basic frame.

Uses :

You can use this feature as like below:

  • Changing the width, height, color of some flash objects, tables, images, links.
  • Changing div tag’s background color, float, style, class, title etc using attributes.

List of attributes

These are the list of attributes that can be used in your shortcoder content. In shortcoder admin page, you will see 16 attributes visible. By total there are 26 attributes that can be used according to your needs.

  • %width%
  • %height%
  • %id%
  • %type%
  • %href%
  • %value%
  • %class%
  • %style%
  • %title%
  • %onclick%
  • %ondblclick%
  • %onmouseover%
  • %onmouseout%
  • %onmouseup%
  • %src%
  • %alt%
  • %allowscriptaccess%
  • %wmode%
  • %data%
  • %flashvars%
  • %movie%
  • %url%
  • %bgcolor%
  • %misc1%
  • %misc2%
  • %misc3%

You cannot use custom attributes. You should only use the above attributes other than this will not be executed.


Simple Example :

Example 1 :

The shortcoder "myMood"s content is "My mood is %misc1% ". Here %misc1% is the attribute.

Now you should use the attribute misc1 with your shortcoder syntax.

In post :
[sc name="myMood" misc1="Happy"]

This will produce the output as

My mood is Happy

or use in post as

[sc name="myMood" misc1="Sad"]

will give output as

My mood is Sad

What happens above ?

In the above example the shortcoder content has a attribute %misc1% . Now you should use [sc name="myMood" misc1="Happy"] in the post. See that the attribute misc1 has been given a value Happy within quotes. Now the output will be My mood is Happy


More Examples :

Example 1 :

Name =
eg1
Content =
<div class="%class%" style="float:%misc1%" title="%title% >Hello my name is %misc2%</div>
In post =
[sc name="eg1" class="exampleClass" float="right" title="This is the title" misc2="Aakash"]
Output =
Hello my name is Aakash

Example 2 :

Name =
youtubeVideo
Content =

<object width="%width%" height="%height%">

<param name="movie" value="%movie%"></param>

<embed src="%movie%" type="application/x-shockwave-flash" width="%width%" height="%height%"></embed>

</object>

In Post =
[sc name="youtubeVideo" width="560" height="340" movie="http://www.youtube.com/v/GOfhmzNLWzY" ]
Output =

blog comments powered by Disqus