WPcustoms WordPress Snippets

Copy the code and paste it in your theme's functions.php file. It can be found in your theme's folder.
You can then run the function by simply typing echo the_functions_name(); wrapped in php brackets.

We take no responsibility that this code is working on your site.
However we do our best to provide tested and optimized snippets.

Exclude sticky posts from main query

Sticky posts are intended to be on top. This function excludes them from the main query so you can add them with a new WP_Query above the main loop. Use this snippet to modify the query with pre_get_posts and forward our query arguments ignore_sticky_posts and post__not_in