zBench theme. What does this code do in the functions file?
-
I had to remove everything after this line to fix an issue with eShop.
add_theme_support( 'post-thumbnails' );I understand that adds support for the “featured image” in posts but I was wondering what the rest does… especially the part that adds an “a href” link. Mostly I am curious if removing it is a good idea or not.
The issue with eShop was that the code here adds an extra link and wraps it around code that eShop outputs too. So it is then redundant, won’t validate, and breaks the layout in some browsers.
// This theme uses post thumbnails add_theme_support( 'post-thumbnails' ); add_image_size( 'extra-featured-image', 620, 200, true ); function zbench_featured_content($content) { if (is_home() || is_archive()) { the_post_thumbnail( 'extra-featured-image' ); } return $content; } add_filter( 'the_content', 'zbench_featured_content',1 ); function zbench_post_image_html( $html, $post_id, $post_image_id ) { $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>'; return $html; } add_filter( 'post_thumbnail_html', 'zbench_post_image_html', 10, 3 );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘zBench theme. What does this code do in the functions file?’ is closed to new replies.