Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JetPack Related Posts
/* You may need to add the !important declaration if your JetPacks CSS loads last - this works for a 6 up layout */
div#jp-relatedposts div.jp-relatedposts-items .jp-relatedposts-post:nth-child(3n+1), div#jp-relatedposts div.jp-relatedposts-items-visual .jp-relatedposts-post:nth-child(3n+1) {
clear: left;
}
@media only screen and (max-width: 640px) {
div#jp-relatedposts div.jp-relatedposts-items .jp-relatedposts-post:nth-child(3n+1), div#jp-relatedposts div.jp-relatedposts-items-visual .jp-relatedposts-post:nth-child(3n+1) {
clear: none;
}
div#jp-relatedposts div.jp-relatedposts-items .jp-relatedposts-post:nth-child(3n) {
clear: none;
}
div#jp-relatedposts div.jp-relatedposts-items .jp-relatedposts-post:nth-child(2n+1) {
clear: left;
}
}
<?php //<~ don't add me in, but add the rest to functions.php
//Change Related Post HEadline
function jetpackme_related_posts_headline( $headline ) {
$headline = sprintf(
'<h3 class="jp-relatedposts-headline"><strong>%s</strong></h3>',
esc_html( 'Similar Stuff Going On' )//change your headline here
);
return $headline;
}
add_filter( 'jetpack_relatedposts_filter_headline', 'jetpackme_related_posts_headline' );
<?php //<~ don't add me in, but add the rest to functions.php
function jetpackme_more_related_posts( $options ) {
$options['size'] = 6; //change the number for the amount required
return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_more_related_posts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment