
Here are various tips related to editing functions.php and functions.php on active theme.
Add Jetpack Infinite Scroll Support To Your WordPress Theme
Infinite scroll offer a better user experience, probably it was first used on social networks like LinkedIn, Facebook and Twitter. Infinite scroll can be an excellent addition to your WordPress blog. Of course, there are pros and cons, but when it is a question of more clicks, visitors tend to leave the website faster.
The hack to add infinite scroll through Jetpack is quite simple, you simply need to edit the functions.php of your active WordPress theme:
add_theme_support( 'infinite-scroll', array( 'container' => 'content', 'footer' => 'page', ) );
Source: https://www.trickspanda.com/2014/05/add-jetpack-infinite-scroll-support-wordpress-theme/
In addition you might want to take a look at the official article related to Jetpack infinite scroll:
https://jetpack.me/support/infinite-scroll/
Delete Long URL Comments
Without a doubt sub-pages and long URL's raise the flag for comment SPAM. I know that one of my best online buddies, try to clean-up comment SPAM from long URL, but he does it manually.
Here is the trick how to delete long URL SPAM for URLs longer than 50 characters, you need to edit your functions.php file:
<?php function rkv_url_spamcheck( $approved , $commentdata ) { return ( strlen( $commentdata['comment_author_url'] ) > 50 ) ? 'spam' : $approved; } add_filter( 'pre_comment_approved', 'rkv_url_spamcheck', 99, 2 ); ?>
Source: https://css-tricks.com/snippets/wordpress/spam-comments-with-very-long-urls/
Delete WordPress Post Older Revisions
Declutering database is essential for WordPress performance. And I have to admit that, even there is autosave, I often click save and create many useless revisions at my WordPress blogs. Sure, sometimes revisions might be useful, but keeping WordPress DB clean is a good practice. You need to paste the following code in functions.php:
global $wpdb; $wpdb->query( " DELETE FROM $wpdb->posts WHERE post_type = 'revision' " );
After code execution, please delete the code. You just need to run this once.
Source: https://www.trickspanda.com/2014/01/how-to-delete-wordpress-post-revisions-using-fuctions-php-file/
Hope you will find these advanced WordPress tips useful, stay tuned for the next edition!