<?php
/* Template Name: Section */
get_header();
global $qlan; include "languages/".$qlan.".php"; // load language file ##
?>
<div id="page">
<?php
if (have_posts()) : // post found ##
while (have_posts()) : the_post(); // start the_loop ##
// add breadcrumb & title ##
?>
<div class="post" id="post-<?php the_ID(); ?>">
<?php
if ( $ql_settings["breadcrumb"] == 1 ) : // show breadcrumb ##
?>
<div class="breadcrumb">
<ul>
<?php echo ql_breadcrumb(); ?>
</ul>
</div>
<?php
endif ; // breadcrumb ##
?>
<h1>
<?php the_title(); ?>
</h1>
<div class="entry">
<?php the_content('Read more »'); ?>
</div>
<?php #include "page-share.php"; ?>
</div>
<?php
endwhile; // the_loop ##
//initialize pagelist variable to hold list of pages to include
#$pagelist = "";
$section_list = array();
// add any children of the current page to the list
$section_set = get_posts('post_type=page&numberposts=-1&post_parent='.$post->ID);
foreach ($section_set as $apage) {
$section_list[] = $apage->ID;
}
#var_dump($pagelist);
#s$pagelist = "1, 2";
// implode ID array at a comma, to a flat string ##
$section_ids_string = implode(",", $section_list);
// loop out home boxes ( all page IDs stored in array $pageids )##
$ql_query = "SELECT * FROM $wpdb->posts
WHERE ID in ( $section_ids_string ) && post_status = 'publish'
ORDER by menu_order asc
LIMIT 20";
#echo $ql_query;
$pageposts = $wpdb->get_results($ql_query, OBJECT);
// keep track ##
$counter = 1;
if ( $pageposts ) : // found ##
?>
<div id="section">
<?php
// test ##
#var_dump($ql_list_section);
$counter = 1; // initialize ##
// loop ##
foreach ( $pageposts as $post ) : // open ##
//setup post data for easy use
setup_postdata($post);
//I use this to skip the feature post in another loop
$feature_post = $post->ID;
if ( has_post_thumbnail( $post->ID ) ) :
//Get the Thumbnail URL
#$domsxe = simplexml_load_string(get_the_post_thumbnail()); echo $domsxe;
#$thumbnailsrc = $domsxe->attributes()->src;
$src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), array( 244, 177 ), false, '' ); //echo $src[0];
$thumbnailsrc = $src[0]; // take first array item ##
else : // no default_thumbnail ##
$thumbnailsrc = get_bloginfo('template_directory').'/images/home_default.jpg';
endif ; // check for default_thumbnail ##
// get parent title ##
#$parent_title = get_the_title($post->post_parent);
#$parent_link = get_permalink($post->post_parent);
if ( $counter == 1 ) :
?>
<div class="row">
<?php
endif; // row ##
?>
<div class="box">
<!–<h3><a href="<?php echo $parent_link; ?>" title="<?php the_title_attribute(); ?>"><?php echo $parent_title; ?></a></h3>–>
<div class="icon">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<img src="<?php echo $thumbnailsrc; ?>" alt="<?php the_title(); ?>" />
</a>
</div><!--.icon-->
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="text">
<?php echo ql_excerpt_from_id( $feature_post, 120 ); // ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">Read More</a>
</div><!--.text-->
</div><!--.box-->
<?php
// iterate ##
$counter++;
if ( $counter == 3 ) :
$counter = 1;
//close the .row div after an even number of box items
?>
</div><!--.row even-->
<?php
endif; // counter ##
endforeach ; // end box loop ##
?>
<?php if($counter == 2) :
//close the .row div if an odd number of box items was displayed ?>
</div><!--.row odd-->
<?php endif; ?>
</div><!--.section->
<?php
endif ; // pages found ##
else : // nothing found ##
?>
<div class="post">
<div class="entry">
<p class="strong"><?php echo $qlan_news_nothing_title; ?></p>
<p><?php echo $qlan_news_nothing_text; ?></p>
</div>
</div>
<?php
endif; // found or not ##
?>
</div><!– eo #page –>
<?php
get_sidebar(); // sidebar ##
get_footer();
?>