Since version 1.9, you can make modifications to the plugin output, without having to modify the plugin code. This way, your tweaks won’t be lost when you upgrade the plugin.
Custom styling
If you want to customize the appearance of the archives using your own CSS, here’s how you do it:
-
Add this code to your theme’s
functions.php
file:add_filter(‘smart_archives_load_default_styles’, ‘__return_false’);
- Copy everything from
smart-archives-reloaded/inc/styles.dev.css
into your theme’sstyle.css
file. - Change the CSS in your theme’s
style.css
file, as needed.
Custom markup
If you want to go one step further and change the generated HTML markup, you can do that too (understanding of object inheritance is required).
First, take a look at the SAR_Generator
class (in smart-archives-reloaded/generator.php
).
In your theme’s functions.php
file, you can extend that class, like so:
class SAR_Custom_Generator extends SAR_Generator {
protected function generate_fancy() {
// your custom code here
}
protected function generate_block() {
// more of your custom code here
}
...
}
Then, all you have to do is add the ‘generator’ argument to the template tag:
<?php smart_archives('generator=SAR_Custom_Generator'); ?>