/*  

Theme Name: Papyrus

Theme URI: http://www.skdstudio.com

Description: WP theme designed by <a href="http://www.skdstudio.com">SK Design Studio</a>.

Version: 1.0

Author: Sherihan Khedr

Author URI: http://www.skdstudio.com



	This theme was designed by Sherihan Khedr.



	By downloading and using this theme, you agree to the following terms:

    - You are NOT allowed to sell this design.
    - A link back to SK Design Studio (either modified or unmodified).
    - You can use this design for personal or commercial projects.
    - You can modify, translate or distribute



*/

#page {
	width: 100%;
	border: none;
	background: none;
}
#header {
	border-bottom: 3px solid #59780a;
	height: auto;
}
#headerimg {
	width: auto;
}
#headerimg .description{
	color: #666666;
	text-align: right;
	padding-bottom: 3px;
	right: 0px;
	position: absolute;
	left: auto;
}
h1 {
	margin:0px;
	font: bold 36px/100% "Trebuchet MS", Tahoma, Arial;
	text-align: right;
	padding-bottom: 3px;
}
h1 a, h1 a:visited{
	color: #000;
	text-decoration: none;
}
#content {
	padding: 10px 0px 30px 0px;
	width: 100%;
}
.post-date {
	font-size: 11px;
	text-transform: uppercase;
	color: #666666;
	height: auto;
}
.post-month, .post-day {
	color: #666666;
	display: inline;
	font-size: 11px;
	padding: 0px;
	margin: 0px;
}
.post-title {
	margin: 0px;
	width: 100%;
	clear: both;
}
.post-cat {
	float:left;
	font-size: 11px;
	padding: 0;
}
.post-comments, .post-calendar {
	float: right;
	font-size: 11px;
}
#comments, #respond, .navigation, #nav, #commentform, #sidebar, #footer, #credits {
	display: none;
}





<?php

    $querystr = "
            SELECT * FROM $wpdb->posts
                LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
                LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)
                LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
                WHERE $wpdb->term_taxonomy.term_id = 5 
                AND $wpdb->term_taxonomy.taxonomy = 'category'
                AND $wpdb->posts.post_status = 'publish'
                AND $wpdb->postmeta.meta_key = 'Sortierung'
                AND STR_TO_DATE($wpdb->postmeta.meta_value, '%Y-%m-%d') >= NOW()
                ORDER BY $wpdb->postmeta.meta_value ASC
        ";

        $posts = $wpdb->get_results($querystr);
        foreach ($posts as $post) :
                setup_postdata($post);

?>

<!-- Whatever shall be displayed -->

<?php endforeach; ?>

