break; case "sv": $lang = "SV"; break; case "en": $lang = "EN"; break; } } $title = $post->post_title; $content = $post->post_content; if ($lang != "FI") { $title = get_field("title_" . strtolower($lang)); $content = get_field("content_" . strtolower($lang)); } $data = array('name' => 'nodes', array('name' => 'node', 'attributes' => array('type' => str_replace('pof_post_', '', $post->post_type)), array('name' => 'lang', 'value' => $lang), array('name' => 'guid', 'value' => wp_hash($post->id)), array('name' => 'id', 'value' => $post->ID), array('name' => 'lastModified', 'value' => $post->post_modified), array('name' => 'lastModifiedBy', 'attributes' => array('userId' => $post->post_author), 'value' => get_userdata($post->post_author)->display_name), array('name' => 'leaf', array('name' => 'title', 'value' => "<![CDATA[" . $title . "]]>"), array('name' => 'content', 'value' => "<![CDATA[" . $content . "]]>"), get_post_tags_XML($post->ID), get_post_images_XML($post->ID), get_post_additional_content_XML($post->ID)))); echo getXML($data); /* echo "<!--"; //print_r($post); echo $post->ID; $images = simple_fields_fieldgroup("additional_images_fg", $post->ID); echo ".."; print_r($images); echo ".."; foreach ($images as $image) { print_r($image); }
function get_childs_for_suoritepaketti($parent_id) { $ret = array('name' => 'childs'); $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => 'pof_post_taskgroup', 'meta_key' => 'suoritepaketti', 'meta_value' => $parent_id); $the_query = new WP_Query($args); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); pof_checkDatetime($the_query->post); $tmp = array('name' => 'node', 'attributes' => array('type' => "taskgroup"), array('name' => 'title', 'value' => $the_query->post->post_title), array('name' => 'guid', 'value' => wp_hash($the_query->post->id)), array('name' => 'id', 'value' => $the_query->post->ID), array('name' => 'details', 'value' => get_site_url() . "/item-xml/?postID=" . $the_query->post->ID), get_post_tags_XML($the_query->post->ID), get_post_images_XML($the_query->post->ID), get_childs_for_suoritepaketti($the_query->post->ID)); array_push($ret, $tmp); } } wp_reset_query(); $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => 'pof_post_task', 'meta_key' => 'suoritepaketti', 'meta_value' => $parent_id); $the_query = new WP_Query($args); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); pof_checkDatetime($the_query->post); $tmp = array('name' => 'node', 'attributes' => array('type' => "task"), array('name' => 'title', 'value' => $the_query->post->post_title), array('name' => 'guid', 'value' => wp_hash($the_query->post->id)), array('name' => 'id', 'value' => $the_query->post->ID), array('name' => 'details', 'value' => get_site_url() . "/item-xml/?postID=" . $the_query->post->ID), get_post_tags_XML($the_query->post->ID), get_post_images_XML($the_query->post->ID)); array_push($ret, $tmp); } } wp_reset_query(); return $ret; }