How do I assign a variable in php for use in WordPress 3.0?

I am using a plugin called Post Snippets, which allows you to define a snippet of HTML and have it appears in the WordPress post using shortcode [snippet].

It says that I can also pass a variable that will be assigned within the snippet, such as {url}.

Read More

I am unclear how to assign the value to the variable url. I have tried to use another plugin called exec-php to execute a php statement:

[exec]url = "domain.com"; [/exec]

But this yields a ‘blank’ value for {url}.

This is all in php within WordPress, so only a quasi programming question, but I figured this would have the most knowledgeable people.

Related posts

Leave a Reply

1 comment

  1. You define the value of the variable when you insert the snippet into a post. You set them up when you create the snippet, and when you insert the snippet into a post using the snippet widget in the editor toolbar, you should have a chance to fill in the value of the variables.

    Basically the snippet is a template and the variables are fields you can fill in any time you insert the snippet. You should end up assigning them at the time you insert the snippet.