开发者

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}.

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]开发者_JS百科

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜