Skip to content

Instantly share code, notes, and snippets.

@neilgee
Last active January 5, 2016 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilgee/e9772ebd0df2c42b033e to your computer and use it in GitHub Desktop.
Save neilgee/e9772ebd0df2c42b033e to your computer and use it in GitHub Desktop.
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