Adding an external HTML link to a page thumbnail
-
I want to add an external HTML link to a post thumbnail using the filter, but the below code does not work for me. It is actually the page, not the post, can I use the post_thumbnail_html filter for page thumbnail?
add_filter( 'post_thumbnail_html', 'my_post_link_html', 10, 3 ); function my_post_link_html( $html, $post_id, $post_image_id ) { if ( $GLOBALS['ghostpool_affiliate_button_link'] ) { $affiliate_link = $GLOBALS['ghostpool_affiliate_button_link']; } $affiliate_target = apply_filters( 'gp_affiliate_link_target', '' ); $html = '<a href="' . get_permalink( $affiliate_link ) . '" rel="nofollow" . target="' . $affiliate_target . '">' . $html . '</a>'; return $html; }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Adding an external HTML link to a page thumbnail’ is closed to new replies.