Template tags

If you want to integrate WP Tiles with your theme or plugin, there are many ways to display the tiles programmatically. Below is an overview of what you do, but for an overview of the full possibilities, have a look in the code.

Displaying WP Tiles anywhere in a template

You can use the function the_wp_tiles anywhere in your templates. It accepts two arguments:

$query – A query, an array of posts or a WP_Query object.

Only if you pass a query or a WP_Query object, pagination will become an available option.

$opts – An array of options. Check Options.php in src/WPTiles/ for an overview of all the options available.

Whenever you add the the_wp_tiles template tag, the tiles will be outputted directly (so no need to echo) and the scripts will be enqueued.

Displaying WP Tiles for the current category

If you want to display all posts in the same category on every single post, or on a category archive, you can use the_category_wp_tiles. It accepts the same arguments as the_wp_tiles, but automatically modifies the query to grab posts from the current category.

Show posts from the loop

If you want to have WP Tiles completely replace the loop, or double up and display all posts that are in the loop, use the the_loop_wp_tiles template tag. It will output all the queried posts on tiles. This function only accepst the $opts argument.

Add beautiful, fully customizable post tiles or tiled galleries anywhere on your WordPress site.