WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. MrJLC
    Member
    Posted 1 year ago #

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

    http://wordpress.org/extend/plugins/smart-archives-reloaded/

  2. ldsphilosopher
    Member
    Posted 1 year 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 )

    function.

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

    static function get_available_tags() {
    		return array(
    			'%post_link%',
    			'%date%',
    			'%excerpt%',
    			'%author_link%', '%author%',
    			'%comment_count%',
    			'%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
    Member
    Posted 1 year ago #

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

  4. MrJLC
    Member
    Posted 1 year 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

About this Topic

Tags

No tags yet.