<?php


/*
 *    Register Ajax Function :: cloudfw_show_post -> cloudfw_ajax_show_post
 *
 *    @since 1.0
**/
if( is_user_logged_in() )
    add_action( 'wp_ajax_cloudfw_show_post', 'cloudfw_ajax_show_post' );
else
    add_action( 'wp_ajax_nopriv_cloudfw_show_post', 'cloudfw_ajax_show_post' );


/*
 *    Get Post via Ajax
 *
 *    @since 1.0
**/
function cloudfw_ajax_show_post() {
    $id = ( isset( $_GET['p'] ) ) ? (int) $_GET['p'] : false;
    query_posts( array( 

		'p' 				=>  $id,
		'post_type'	 		=>	array('portfolio'),
		'post_status'		=>	'publish',
		'posts_per_page'	=>  -1,
	
	) );
    if ( have_posts() ) {
        while( have_posts() ) {
            the_post();
            the_content();
        }
    }
    else {
        print '<p>No posts, ID: '.$id.'</p>';
    }
    exit;
}


/*
 *    Register Ajax Function :: cloudfw_contact_form -> cloudfw_ajax_contact_form
 *
 *    @since 1.0
**/
include_once(TMP_INCLUDES . '/functions/mail_functions.php');
if( is_user_logged_in() )
    add_action( 'wp_ajax_cloudfw_contact', 'cloudfw_ajax_contact_form_callback' );
else
    add_action( 'wp_ajax_nopriv_cloudfw_contact', 'cloudfw_ajax_contact_form_callback' );