Smart Archives Reloaded
Add thumbnail image to fancy.html (4 posts)

  1. MrJLC
    Posted 3 years ago #

    Can the code be tweaked so that it also adds a thumbnail image next to the post list ?


  2. ldsphilosopher
    Posted 3 years ago #

    I'm no expert, but I believe I may have succeeded in doing just that last night.

    In the generator.php file, I added this:

    protected function substitute_thumbnail( $post ) {
    		return the_post_thumbnail( array(65,65) );

    right after the end of the

    function substitute_category( $post )


    THEN, in the core.php file, I added "%thumbnail%" to the list of shortcodes, as such:

    static function get_available_tags() {
    		return array(
    			'%author_link%', '%author%',
    			'%category_link%', '%category%', '%thumbnail%',

    Be sure to back up and save. I did it wrong the first time and had to manually delete the plugin and reinstall it before I could get back into wordpress. But the second time, it worked like a charm.

    But I've NEVER done anything like this before. I don't know code. I simply guessed (based on patterns I saw in the code), and was flabbergasted and did a little dance when it worked. YAY!

  3. ldsphilosopher
    Posted 3 years ago #

    To clarify, this should allow you to use the %thumbnail% shortcode.

  4. MrJLC
    Posted 3 years ago #

    Thanks for the information.

    Did you have to make any changes to:

    function generate_fancy() {

    within the file generator.php ?

    For example, in function generate_fancy() Ive added this:
    'archive-image' => "<img src='".$thumbnail."' border='0'>",

    and fancy.html, made this change:
    <ul class="archive-list">
    <h2>{{{archive-image}}} {{{post-list}}}</h2>

    However, no image is showing up, so I guess the variable $thumbnail is not applicable in this scenario as when I view the HTML page, I can see <img src='' border='0'>

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Smart Archives Reloaded
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.