Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

jwiere03 on "Parameter for shortcode plugin"

$
0
0

I'm learning how to make my own plugins and shortcodes and I thought I'd combine the two and try to make a plugin that adds a shortcode that generates some text.

I have added a parameter that allows the user to pick how many paragraphs they want the shortcode to generate. However currently the shortcode has to be written like this
[text size=4]
In the function I use this to extract the value from the shortcode

function text_function($atts) {
  extract(shortcode_atts(array(
      'size' => 1,
   ), $atts));

What I would like to do is be able to just write the shortcode like this
[text 3]
And not have to include the name of the parameter since I'm only using one anyway and it makes it easier for adding the shorcode if you don't need to add it.

How do I add this feature?
Thanks


Viewing all articles
Browse latest Browse all 8245

Trending Articles