<?php
$wpLocation = str_replace("wp-content/themes/walker-wp/js", "", dirname(__FILE__));
require_once( $wpLocation . 'wp-load.php' );
if (isset($_POST['pid'])){
//set the query_posts args
$args= array(
'p' => $_POST['pid'],
'post_type' => DESIGNARE_PORTFOLIO_POST_TYPE
);
$project_id = 1;
$the_cat = array();
query_posts($args);
if(have_posts()) {
while (have_posts()) {
the_post();
$cat_class = "";
$cat_name = "";
$cat_type = "";
$terms = get_the_terms($post->ID, 'portfolio_category');
if ( $terms && ! is_wp_error( $terms ) ) {
foreach ( $terms as $t ) {
array_push($the_cat, $t->slug);
$cat_class .= $t->slug . " ";
$cat_name .= $t->name . ", ";
}
}
$terms2 = get_the_terms($post->ID, 'portfolio_type');
if ( $terms2 && ! is_wp_error( $terms2 ) ) {
foreach ( $terms2 as $t2 ) {
$cat_type .= $t2->name . ", ";
}
}
$result .= "<div class='fullscreen-info' style='display:none'><div class='title'>". get_the_title()."</div><div class='images'>";
$coll = designare_get_slider_data(get_post_meta($post->ID, 'collection_value', true));
$totalImg = 0;
foreach($coll['posts'] as $c){
$p = get_post_meta($c->ID, 'custom_video_id');
$result .= "<div id='video_src'>" . $p[0] . "</div>";
if ($totalImg == 0) $firstImg = $p[0];
$totalImg++;
}
$content = do_shortcode(get_the_content());
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$result .= "</div><div class='FSdescription'><div class='FStop'><div class='type'>". substr_replace($cat_type, '', -2)."</div><div class='category'>". substr_replace($cat_name, '', -2)."</div></div><div class='FScontent'>". $content ."</div></div></div>";
}
$project_id++;
} else { $result = "nao ha ca nada"; }
//$result = "osidjfhbspijfb ";
$result = htmlspecialchars($result);
$result = preg_replace('/\s+/', ' ',$result);
echo '{"response":{"error": "1", "content":"'. $result . '", "totalImg": "'. $totalImg .'", "firstImg":"'.$firstImg.'" }}';
}