Updated get_posts method in php templates