WordPress.org

Support

Support » Plugins and Hacks » Ambrosite Next/Previous Post Link Plus » [Resolved] Place thumb image inside link format. %thumb?

[Resolved] Place thumb image inside link format. %thumb?

Viewing 2 replies - 1 through 2 (of 2 total)
  • For example:

    $nextPostFormat = '%link';
    $nextPostLink = '%thumb<span class="direction">Next <span class="arrow">▶</span></span><span class="next_title">%title</span>';
    
    next_post_link_plus( array(
    	'thumb' 		=> 'medium',
    	'format' 		=> $nextPostFormat,
    	'link'			=> $nextPostLink,
    	)
    );
    Plugin Author ambrosite

    @ambrosite

    It’s possible if you are willing to hack the plugin code. You need to find these lines (368-373 in version 2.4):

    if ( $r['thumb'] && has_post_thumbnail($post->ID) ) {
        if ( $r['thumb'] === true )
            $r['thumb'] = 'post-thumbnail';
        $thumbnail = '<a class="post-thumbnail" href="'.get_permalink($post).'" rel="'.$rel.'"'.$tooltip.'>' . get_the_post_thumbnail( $post->ID, $r['thumb'] ) . '</a>';
        $format = $thumbnail . '<span class="post-link">' . $format . '</span>';
    }

    Replace them with this:

    if ( $r['thumb'] && has_post_thumbnail($post->ID) ) {
        if ( $r['thumb'] === true )
            $r['thumb'] = 'post-thumbnail';
        $thumbnail = get_the_post_thumbnail( $post->ID, $r['thumb'] );
        $format = str_replace('%thumb', $thumbnail, $format);
    }

    I have not tested this code but I think it should work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Place thumb image inside link format. %thumb?’ is closed to new replies.
Skip to toolbar