How to customise related posts widget
-
I’m trying to change up the appearance of my related posts widget to better display my featured images which are square.
I want to create 4 images across the page, each 150px square, with the title underneath.
I’ve patched together some changes but don’t really know what I’m doing.
I’ve changed the posts displayed to 4 and changed the thumbnail size, but the titles aren’t wrapping correctly, they are wider than the images, and so the 4th image is dropping down to the next line.
You can see examples at debycoles.com (its the related section at the bottom of the articles)This is my code:
'//* JetPack related posts // show 4 related posts function jetpackchange_howmany_related_posts( $options ) { $options['size'] = 4; return $options; } add_filter( 'jetpack_relatedposts_filter_options', 'jetpackchange_howmany_related_posts' ); // change thumbnail size function jetpackchange_image_size ( $thumbnail_size ) { $thumbnail_size['width'] = 150; $thumbnail_size['height'] = 150; // $thumbnail_size['crop'] = true; return $thumbnail_size; } add_filter( 'jetpack_relatedposts_filter_thumbnail_size', 'jetpackchange_image_size' ); function jetpackme_related_posts_headline( $headline ) { $headline = sprintf( '<h2 class="jp-relatedposts-headline"><em>%s</em></h2>', esc_html( 'More from this site:' ) ); return $headline; } add_filter( 'jetpack_relatedposts_filter_headline', 'jetpackme_related_posts_headline' ); add_filter( 'jetpack_relatedposts_filter_post_context', '__return_empty_string' );'
Can anyone help?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How to customise related posts widget’ is closed to new replies.