WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

AnyVar

AnyVar is a simple search and replace plugin. It lets you add changeable variables (text snippets) to posts, sidebars, widgets, links & themes.

How do I use AnyVar

All you need to do is create a variable in the admin section, then add the [variable_tag] to your HTML code. This tag can go straight into your posts, pages, themes, links, widgets etc.

What's the use? I could just change it myself

The beauty (and power) of AnyVar comes into play when you have multiple copies of the same piece of code &/or text in more than one place. It's almost like a templating system within a templating system (WordPress).

Go on...

Ok, consider these examples:

You like putting ads inside your posts, but you also like to change advertisers occasionally. So you create a variable called [post_ad] which contains the html for the ad. The next month you decide to change the ad, all you do is update the [post_ad] variable in the AnyVar admin section, and hey presto, every post you've put your [post_ad] tag (could be 5, 50, 100 posts) is automatically instantly change.

You've decide to add a 'thought for the day' quote to your blog. You could manually change the theme each day to reflect this, or your could add a [daily_thought] variable and update this each day inside the WordPress admin, without having to touch the theme.

The usefulness of this plugin is only limited by your imagination... :)

How does it work

The non-technical version is that replaces the [variable_tag] with the variable text at the end of the process of making the page.

The technical version is that it uses PHP's output buffering to do the search / replace once WordPress has finished generating that output.

Doesn't output buffering effect the performance of a PHP script?

Yes. However, in the relatively small amount of benchmarking I've done, AnyVar has actually slightly lowered the WordPress page load time (by a few milliseconds). I'd say this is due to cutting down the number of echo / output commands sending data to the browser.

Requires: 2.0.0 or higher
Compatible up to: 2.5.1
Last Updated: 2008-7-8
Downloads: 1,438

Ratings

3 stars
3.8 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1