// 2011.07.11: [child_content_view query=" parent ID(tag_id)" orderby="modified" div_hide=''] // 2011.07.14: Added security check code and fixed the issue of . If found out #xxx, it converts "URL#xxx" . // 子ページの内容も含めた全表示 (ALL pages under parent page) // div_hide: 'class="test"' --replaced--> style="display:none;" class="test" // If you'd like to use multi keywords, please write 'class="test",id="test2"' // Prevent recursion global $outerPost; if ($outerPost) return ''; // Parse parameters extract(shortcode_atts( array('query' => '','orderby' => 'orderby=modified', 'div_hide'=>'' ), $atts)); $query = attribute_escape(strip_tags(html_entity_decode($query,ENT_QUOTES))); $orderby = attribute_escape(strip_tags(html_entity_decode($orderby,ENT_QUOTES))); $hide_dev = attribute_escape(strip_tags(html_entity_decode($hide_dev,ENT_QUOTES))); if( empty($query) ) return ''; if( empty($orderby) ) $orderby = "modified"; if( !empty($div_hide) ){ if(preg_match("/,/", $div_hide)){ $div_hide_array = explode(",", $div_hide); }else $div_hide_array[] = $div_hide; } // Create new post loop global $post; $outPost = $post; $child_posts = get_posts( 'numberposts=-1&order=ASC&orderby=' . $orderby . '&post_type=page&post_parent=' . $query ); if ( $child_posts ) { foreach ( $child_posts as $child ) { $c_pagelink = get_page_uri( $child->ID ); $c_title = attribute_escape(apply_filters( 'the_title', $child->post_title ) ); if(empty($child->post_content)) continue; $c_content = get_extended( $child->post_content ); $c_content = apply_filters( 'the_content', $c_content['main'] ) ; if (isset($div_hide_array) && is_array($div_hide_array)) $c_content = str_replace('href="#', 'href="' .$c_pagelink. '#', $c_content); echo '
'; echo '

'. $c_title . '

'; if (isset($div_hide_array) && is_array($div_hide_array)){ foreach($div_hide_array as $div_a){ if(preg_match('/'.preg_quote($div_a).'/', $c_content)) $c_content = str_replace($div_a, 'style="display:none;" ' . $div_a, $c_content); } } echo $c_content; echo '
'; } }