<?php
/**
 *
 * @link              https://bowdenworks.com
 * @since             1.0.0
 * @package           BwSurveyCustom
 *
 * @wordpress-plugin
 * Plugin Name:       Site Specific Custom Features
 * Plugin URI:        https://bowdenworks.com
 * Version:           1.0.0
 * Author:            Bowden Works
 * Author URI:        https://bowdenworks.com
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       bw-survey
 */

// If this file is called directly, abort.
if ( ! defined('WPINC') ) {
	die;
}

function bw_survey_custom_add_pages( $pages, $r ){
	if(isset($r['name']) && 'page_on_front' == $r['name']){
		$args = array(
			'post_type' => 'survey'
		);
		$surveys = get_posts($args);
		$pages = array_merge($pages, $surveys);
	}

	return $pages;
}
add_filter( 'get_pages', 'bw_survey_custom_add_pages', 10, 2 );

// function bw_survey_custom_enable_front_page_surveys( $query ){
// 	if('' == $query->query_vars['post_type'] && 0 != $query->query_vars['page_id'])
// 		$query->query_vars['post_type'] = 'survey';
// }
// add_action( 'pre_get_posts', 'bw_survey_custom_enable_front_page_surveys' );
