Specify Replacement Directory for CSS url Images
Directory Macro Replacement for CSS images
This option is really obscure, and unlikely to be needed by virtually all Weaver Xtreme users.
Sometimes you might want to add a background image to a style (e.g., using a url() value). Those images need to be stored someplace available to visitors to your site. One typical place is to use the WordPress media gallery, and use the full URL to those images.
Because you might be building a child theme, or an Add-on Subtheme, Weaver Xtreme Plus provides a handy macro replacement capability for Custom CSS Rules and CSS+ rules. For example, if you want to supply some background images for a child theme, and you would like to save those images in a directory called /images in the child theme directory, you can use the macro %stylesheet_directory% in a style url() value.
For example, say you’ve built a child weaver theme, and have a file called content-bg.jpg stored in the child theme’s /images directory. You can specify the location of that file in a site independent manner by using:
#content {background-image: url(%stylesheet_directory%images/content-bg.jpg);}
The %stylesheet_directory% will be replaced in the generated CSS code as
url(/wp-content/themes/your-child-theme/images/content-bg.jpg)
The file directory macros supported by Weaver Xtreme will produce a root-relative path, and include the trailing /. Using a root-relative path eliminates issues with http and https protocols, and will be site independent. The following macro values are supported:
%template_directory% – the main theme directory. If the theme is a child theme, this will be the directory of the parent theme (so /weaver-xreme/).
%stylesheet_directory% – the directory of the theme’s stylesheet – thus if it is a child theme, then this will be the child theme’s directory.