seancojr
4/7/2014 - 3:25 AM

wp-tiles-menu.php

<?php
add_filter( 'wp-tiles-data', 'fixed_page_tiles', 10, 4 );
function fixed_page_tiles( $data, $posts, $colors, $tiles_obj ) {
    $pages = get_pages();

    foreach ( $pages as $page ) {
	    $position = get_post_meta( $page->ID, 'tile-position', true );
		if ( empty ( $position ) || ! is_numeric ( $position ) )
			continue;
	
		$tiledata = array (
		    "id"        => $page->ID,
		    "title"     => $page->post_title,
		    "url"       => get_permalink( $page->ID ),
		    "category"  => wp_get_post_categories( $page->ID, array ( "fields" => "names" ) ),
		    //"img"       => $tiles_obj->get_first_image ( $page ),
		    "img"       => get_stylesheet_directory_uri() . '/images/' . $page->post_name . '.png',
		    "color"     => $colors[ array_rand( $colors ) ],
		    "hideByline" => true
		);
		
		array_splice ( $data, $position - 1, 0, array ( $tiledata ) );
	}
	return $data;
}